我在一个表单中得到了很多qtips,像这样:
$('.selector').qtip({
content: {
text: function(api) {
// Retrieve content from custom attribute of the $('.selector') elements.
return $(this).attr('qtip-content');
}
}
});我不想单独添加所有的qtips,因为它会创建许多javascript事件,这是我不喜欢做的。
我得到的html是这样的,我想这会让我的问题更容易回答:
<tr>
<td>
Main Alliase/Current Alliase:
</td>
<td><input type="text" id="maina"/>
</td>
<td id="handle-1" qtip-content="ToolTip's content here" class="selector">?</td>
<td><div id="error-1" class="errors"></div></td>
</tr>现在我想要的是,当我关注#maina时,它会改变qtip对应类selector的状态。
但是当我使用这个的时候:
$('.selector').qtip('toggle', true);当然,这也是与之相关的所有工具提示
我怎样才能达到我的目标?
发布于 2011-07-31 05:12:55
这可能会有所帮助:
$("#maina").bind("focus", function () {
$(this).closest("tr").find(".selector").qtip('toggle', true);
});https://stackoverflow.com/questions/6885685
复制相似问题