后我想删除所有表行的用户点击了复选框后,除了与自身的复选框的表行,并在未选中该复选框再次显示表中的行后面。我的代码仅用于删除,但我需要在取消选中后再次显示表格。显示/隐藏表行点击复选框
function Showhidefunc(btndel) {
if (typeof(btndel) == "object") {
$('table tr td:first-child :checkbox:not(:checked)').closest('tr').remove();
} else {
return false;
}
}
<thead>
<tr>
<th>Select</th>
<th>Month</th>
<th>Username</th>
<th>Deduction</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" onChange="Showhidefunc(this);"></td>
<td><?php echo $Name_row ['Month'];?></td>
<td><?php echo $Name_row ['Username'];?></td>
<td><?php echo $Name_row ['Total_Deduction'];?></td>
</tr>
</tbody>
谢谢你们:)
不要'一个.remove()'行 - 一旦你删除它们,他们走了。使用'.hide()''然后.show()' –
你可以使用jQuery的[切换()](http://www.w3schools.com/jquery/eff_toggle.asp)。 –
也帮助我,谢谢。 –