【发布时间】:2014-08-30 05:02:00
【问题描述】:
在我的项目中,我使用 jquery Tipsy tooltp 来验证表单的字段。 我想一次性隐藏所有打开的工具提示,而不必指定每个元素的 id,但不幸的是我不能。 我试过这种方式,但按钮 hide2 和 hide3 无法正常工作。
<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');
});
我该怎么办?谢谢
【问题讨论】:
标签: javascript jquery html css animation