Trying to temporarily disable the jQuery tooltip
$(document).tooltip( "option", "disabled", true );
When I try to re-enable them again, all of the title
attributes are gone. I was trying to re-enable them using:
$(document).tooltip( "option", "disabled", false);
The title
attributes is actually being removed completely when i first set it to disabled
to true
.
Also tried:
$(document).tooltip("disable");
$(document).tooltip("enable");
It is doing the same thing...
Update
Found a solution to my own question with the help of Jasen and zgr024. See below.
This appears to be a bug with the jquery version so you need a work-around to insert the title attribute after disabling tooltips.
Use a class name on the tooltip element you need re-enabled or use the [title]
attribute selector.
<input type="text" class="tooltip-hack" title="tooltip text" />
$("#disable").on("click", function (e) {
var tooltips = $("[title]"); // or $(".tooltip-hack")
$(document).tooltip("disable");
tooltips.attr("title", "");
});
Use the least destructive of the two depending on your html structure.
Also, you note that all title attributes are removed so be more selective with your tooltip.
// instead of
$(document).tooltip();
// use a more restrictive selector
$(".tooltip-hack").tooltip();
Working example: jsFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With