Jquery tooltipster plugin, hide all tips?

if i bind the tooltipster to input elements and other elements like div, is there a way to hide everything in one call?

So far I know I can do it manually:

$ ('form input'). tooltipster ('hide'); $ ('# Mydiv') tooltipster ('hide') ;.

+3


source to share


2 answers


It's simple, you just need to separate your selectors with a comma :

$('form input, #mydiv').tooltipster('hide');

      



If you don't know the exact elements containing the tooltipster, you can use the method filter

:

$('*').filter(function() {
    return $(this).data('tooltipsterNs');
}).tooltipster('hide');

      

+4


source


Tooltipster adds a CSS class to elements with a tooltips attached: "tooltipstered".

So one of the methods is to call

$('.tooltipstered').tooltipster('close');



Edit : With Tooltipster v4, you can do this with publicly available methods, which are always better. Also, it also works when you use tooltips with an option multiple

, while my previous answer:

var instances = $.tooltipster.instances();
$.each(instances, function(i, instance){
    instance.close();
});

      

+10


source







All Articles