gpt4 book ai didi

jQuery .nextAll 不起作用?

转载 作者:行者123 更新时间:2023-12-03 23:06:11 25 4
gpt4 key购买 nike

我得到了这个html

<tr>
<td>
Main Alliase/Current Alliase:
</td>
<td><input type="text" id="maina" class="countchars" max="30"/><br />
<span class="showchars"></span>
</td>
<td><span id="handle-1" class="selector" title="The Main Alliase with which people know you OR the alliase with which u play most <br /> <b>You'r App would be also named after this only</b>" header="Main Alliase/Current Alliase">?</span></td>
<td><div id="error-1" class="errors"></div></td>
</tr>

还有这个js:

$('#maina').focus(function() {
$(this).closest("tr").find(".selector").qtip('toggle', true);
$(this).nextAll(".errors:first").html("Bla");
$(this).siblings(".showchars").show();
});

但是当我专注于 maina 时,它会执行其他两件事,但不会更改 errors 类的 html。

为什么会这样呢?我做错了什么?请帮我谢谢

最佳答案

我认为你应该这样做:

 $(this).closest('tr').find(".errors:first").html("Bla");

这是因为 nextAll() 会查找同级元素(获取匹配元素集中每个元素的所有后续同级元素,可选地通过选择器进行过滤),而 maina 的唯一同级元素是 span

关于jQuery .nextAll 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6909238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com