<table>
<tr></tr>
<tr>
First Want to select this tr
<td>
<table>
<tr>
<td></td>
</tr>
<tr>
<td>Then Want to select this one</td>
</tr>
</table>
</td>
</tr>
</table>
我在变量中有页面内容,我只需要使用find方法。
答案 0 :(得分:0)
$("table").find("tr:nth-child(2)").find("tr:nth-child(2)").css("color","red")
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr></tr>
<tr>
First Want to select this tr
<td>
<table>`
<tr>
<td></td>
</tr>
<tr>
<td>Then Want to select this one</td>
</tr>
</table>
</td>
</tr>
</table>
&#13;
答案 1 :(得分:0)
第二行的伪选择器可用于获取其内容。
$.find('table tr:nth-child(2)').html()