if I have bound tooltipster to input elements and to a diferent elements like a div, is there a way I can hide all in a single call?
So far I know I can to this by hand with:
$('form input').tooltipster('hide'); $('#mydiv').tooltipster('hide');
Tooltipster does add a CSS class to elements that have a tooltip attached : "tooltipstered".
So one technique among others is to call
$('.tooltipstered').tooltipster('close');
Edit: with Tooltipster v4, you can actually do this with the public methods, which is always better. Besides, it also works when you use tooltips with the multiple
option, while my previous answer does not:
var instances = $.tooltipster.instances();
$.each(instances, function(i, instance){
instance.close();
});
It's simple, you just need to separate your selectors by comma:
$('form input, #mydiv').tooltipster('hide');
If you don't know exact elements that contain tooltipster you can use filter
method:
$('*').filter(function() {
return $(this).data('tooltipsterNs');
}).tooltipster('hide');
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