Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取表的eq()和第n个子项_Javascript_Jquery_Html - Fatal编程技术网

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)')