Testing to see if jQuery UI Tooltip is open

I am trying to control the automatic opening and closing of the jQuery Tooltip .

How to check if the current state of a tooltip is open?

I use the latest versions of everything.

Thank!

+5
source share
1 answer

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

$(".ui-tooltip").length

Or, alternatively, you can use the API to check if it is open. You can set the 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 find out the current status of the tooltip, you can use this:

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

It returns trueif it is open, and falseif it is closed. Hope this helps ...

+7
source

All Articles