In my project I'm using jquery tipsy tooltp to validate the fields of a form. I would like to hide all open tooltips in one shot without having to specify the id of each element, but unfortunately I can not. I tried this way, but the buttons hide2 and hide3 not work properly.
<p><input type="text" name="name" id="name" rel="ttp" /></p>
<p><input type="text" name="sname" id="sname" rel="ttp" /></p>
<p><input type="text" name="email" id="email" rel="ttp" /></p>
<input type="button" value="show" id="show_ttp">
<input type="button" value="hide" id="hide_ttp">
<input type="button" value="hide2" id="hide2_ttp">
<input type="button" value="hide3" id="hide3_ttp">
JS
$('[rel=ttp]').tipsy({trigger: 'manual', gravity: 'w'});
$("#show_ttp").click(function(){
$('#name').attr('title', 'name').tipsy('show');
$('#sname').attr('title', 'surname').tipsy('show');
$('#email').attr('title', 'email').tipsy('show');
});
$("#hide_ttp").click(function(){
$('#name').tipsy('hide');
$('#sname').tipsy('hide');
$('#email').tipsy('hide');
});
$("#hide2_ttp").click(function(){
$('*').tipsy('hide');
});
$("#hide3_ttp").click(function(){
$('[rel=ttp]').tipsy('hide');
});
http://jsfiddle.net/tm9V2/
How could I do? thank you
To hide all the tipsy tooltip just use .tipsy class as a selector and hide it using jquery hide()
CODE :
$("#hide2_ttp").click(function(){
$('.tipsy').hide();
});
Fiddle Demo
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