Search code examples
jqueryjquery-uijquery-ui-tooltipjquery-widgets

Open jquery ui tooltip programmatically with custom content


I want to programmatically open a jquery ui tooltip (not hover) with a custom content tooltip like this here. Is there any way to do this ?

$('.links').tooltip({
  content: function() {
    var $this = $(this);
    var extra = $this.text();
    var lowertext = "<div class ='tooltiptext'>Find out more about " + extra + "</div>"
    return lowertext;
  }
  $('.links').tooltip("open");

Solution

  • Try to trigger the mouseover() event after initializing the tooltip:

    $('.links').tooltip().mouseover();