【发布时间】:2014-07-02 20:50:53
【问题描述】:
如何获取列表中与选择器匹配的第一个(下一个)元素?
例子:
<table>
<tr class="test"><td>not this one</td></tr>
<tr><td><a title="test">click</a></td></tr>
<tr><td>not this one</td></tr>
<tr class="test"><td>this one</td></tr>
<tr class="test"><td>ignore this as well</td></tr>
</table>
$("a").on('click', function(eve){
$(this).parents("tr").???(".test").toggle();
});
编辑
我需要下一行。兄弟姐妹也得到其他人(如第一行)
【问题讨论】:
-
你想做什么??
-
我有一些动态行由上一个行打开和关闭。我不能使用'next()',因为我不知道我将拥有哪些行 - 以及有多少。