我在 iframe 标签中有两个 html 表,没有 class 和 id 属性。 我正在尝试使用 jQuery 查找第二个表的第一行并将其隐藏? 我的表是这样的: 注意:基本上我有两个表,两个表都在 iframe 标签内。我需要隐藏第二个表格的第一行吗?
<table>
<tr>
<td> 1 </td>
.
.
.
</tr>
</table>
我需要隐藏下表的第一行:
<table>
<tr>
<td> This row i need to hide() </td>
</tr>
</table>
我也试过这样的方法:
$( "table[1] tr:first" ).css("display", "none" );
但是没有结果... 请帮忙。
最佳答案
我建议,假设 <table>
元素不是 sibling :
$("table").eq(1).find("tr:first").hide();
使用选择器的解决方案 :nth-child(2)
仅在第二个 <table>
时有效是其父项的第二个子项,并将选择 every t <table>
那是它 parent 的第二个 child 。
关于javascript - 隐藏没有类和 id 属性的 html 表 2 的第一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25350995/