我有下表:
<table id="some-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>UI Status</th>
<th>Engine Status</th>
</tr>
</thead>
<tbody>
<tr>
<th>A</th>
<th>1</th>
<th></th>
<th></th>
</tr>
<tr>
<th>B</th>
<th>2</th>
<th></th>
<th></th>
</tr>
</tbody>
</table>
我想将UI状态插入索引。
$(#'some-table tbody tr').eq(0)
将为我提供我想要的行,但是我将如何在该tr
中获得第三个th
,以便我可以更新UI状态。
任何帮助都将不胜感激。
谢谢。
您可以连锁呼叫以在元素中找到孩子:
$(#'some-table tbody tr').eq(0).find('th').eq(2)
您也可以在选择器中使用:eq
伪类:
$(#'some-table tbody tr:eq(0) th:eq(2)')