Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing to see if a jQuery UI Tooltip is open

I'm trying to control the automatic opening and closing of a jQuery Tooltip.

How do I test to see if the current status of a tooltip is open?

I'm using the most recent versions of everything.

Thanks!

like image 611
kevin Avatar asked Feb 20 '13 01:02

kevin


1 Answers

You can try by checking if there are any classes with ui-tooltip.

$(".ui-tooltip").length

Or, alternatively, you can use the API to check if it is open. You can set a flag and check using:

$(".selector").on("tooltipopen", function(event, ui) {
    $(this).data("tooltip", true);
});
$(".selector").on("tooltipclose", function(event, ui) {
    $(this).data("tooltip", false);
});

To know the current status of the tooltip, you can use this:

$(".selector").data("tooltip");

It returns true if open, and false if closed. Hope this helps...

like image 194
Praveen Kumar Purushothaman Avatar answered Oct 18 '22 02:10

Praveen Kumar Purushothaman