我有一个表,我填充一些数据,除了每个复选框,最后一个复选框是“全部”。 当我检查这个“ALL”复选框时,应该选中复选框,反之亦然。如何做选择所有当选中一个复选框
填充数据的代码。
<div class="tablecontatiner">
<table>
<tr>
<th>Function</th>
<th>Add</th>
<th>Edit</th>
<th>View</th>
<th>Delete</th>
<th>All</th>
</tr>
@foreach (var item in Model)
{
<tr class="grouprow">
<td><input type="hidden"/><input id="@(item.Func_Code)" type="checkbox" style="visibility:hidden" />@item.FunctionName</td>
<td><input id="@(item.Func_Code + "A")" type="checkbox" value="Add" @(item.Add==true?"checked":"") /></td>
<td><input id="@(item.Func_Code + "E")" type="checkbox" value="Edit" @(item.Edit==true?"checked":"") /></td>
<td><input id="@(item.Func_Code + "V")" type="checkbox" value="View" @(item.View==true?"checked":"")/></td>
<td><input id="@(item.Func_Code + "D")" type="checkbox" value="Delete" @(item.Delete==true?"checked":"")/></td>
<td><input id="@(item.Func_Code + "ALL")" type="checkbox" value="All"/></td>
</tr>
}
</table>
</div>
和我的UI看起来像:
什么是#chekcboxAll她...该复选框的ID?或值或复选框? – Santosh
应该检查/取消选中全部的复选框的ID – Anton
尝试了您的演示...但没有为我取消选中任何一个checkbox.the所有复选框应该取消选中 – Santosh