我正在尝试到达 div 中的第 2 个表第 7 行第 1 个 td。
我试过了
$('#WebPartWPQ1 table:first table:first tr:nth-child(6) td:first').html('test')
但它什么也没显示
<div id='WebPartWPQ1'>
....
....
<table>
<tbody>
<tr>
<td>
<span>
....
.....
<table>
<tbody>
...
<tr> //7th row
<td> //1st td
<h3>
<nobr>
This value has to change
</nobr>
</h3>
</td>
如何解决?
最佳答案
Description: Selects all elements that are the nth-child of their parent.
index: The index of each child to match, starting with 1, the string even or odd, or an equation ( eg. :nth-child(even), :nth-child(4n) )
:nth-child()
以 1 开始,将:nth-child(6)
更改为:nth-child(7)
。$('#WebPartWPQ1 table table tr:nth-child(7) td:first').html('test')
使用此选择器。
关于jquery - 尝试使用 jQuery 到达第 2 表第 7 行第 1 td,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41821066/