我遇到了一个问题我怀疑有一个非常简单的解决方案,但它让我很难过。在以下代码中
$(document).ready(function() {
$('#btnHide').click(function() {
$('td:nth-child(1)').nextUntil(':nth-child(4)').toggle();
});
});
和html
<table id="tableOne">
<tr>
<td></<td>
</tr>
</table>
我如何更改javascript,以便它不会定位所有表格,只是那个id ='tableOne'的表?
答案 0 :(得分:1)
在选择器中添加该表:
$('#tableOne td:nth-child(1)').nextUntil(':nth-child(4)').toggle();