我有两个 html 表:
<table id="tabA">
<tr>
<td> </td>
</tr>
<tr>
<td>
<table id="tabB">
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
因此,如果我使用 $("#tabA tr").length
我会收到 3 而不是 2。我只想计算 tabA 长度。
最佳答案
这应该有效:
$("#tabA > tbody > tr").length;
关于javascript - jQuery 表中的表长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14081583/