Search code examples
javascriptjqueryruby-on-railsjquery-uitooltip

jQuery UI Tooltip won't disappear after click


$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});

I'm using some basic JS to have tooltips enabled on hover. However, if I click the icon with the tooltip, it will remain there until I click something else. How would I change my code above to do this ?


Solution

  • Check out the jQuery hover() method, which has enter and exit handlers: http://api.jquery.com/hover/

    You can call open() and close() on the tooltip on enter and exit respectively: http://api.jqueryui.com/tooltip/#method-open

    http://api.jqueryui.com/tooltip/#method-close