Question

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");
Was it helpful?

Solution

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

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

OTHER TIPS

Yes it works like you tried it, but your problem are your typos, you forgot some ;and brackets also. try like this:

    $('.links').tooltip( {
                    content: function () { 
                        var lowertext = "<div class='tooltiptext'>Find out more about " + $(this).text() + "</div>";
                        return lowertext;
                    }
    });
    $('.links').tooltip('open');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top