Javascript 获取表的eq()和第n个子项
我有下表:Javascript 获取表的eq()和第n个子项,javascript,jquery,html,Javascript,Jquery,Html,我有下表: <table id="some-table"> <thead> <tr> <th>Name</th> <th>Type</th> <th>UI Status</th> <th>Engine Status</th> </tr> </thead> <tbody> <tr>
<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>
名称
类型
用户界面状态
发动机状态
A.
1.
B
2.
我想将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)')