您好我想只通过顶层迭代的标签意味着table.Below的子标签是我的HTML如何只通过顶层遍历表
<table id="tab1">
---> <tr>
<td>
<table>
<tr><td></td></tr>
<tr><td></td></tr>
</table>
</td>
</tr>
---> <tr><td></td></tr>
---> <tr><td></td></tr>
</table>
如果我使用过的所有TR标签迭代下面的代码
$('#tab1 tr').each(function()
{
// This will iterate through all the <tr> (5 tags)..
});
但我想通过我与>标记。你可以使用下面的小提琴把手放在提到的S迭代
http://jsfiddle.net/AzJRp/1/
同一个问题: http://stackoverflow.com/questions/977883/selecting -only-first-level-elements-in-jquery –