CheckBox全选、取消全选

时间:2022-10-01 21:13:38

关于CheckBox全选取消全选

          //全选
$("#SysAllSelectedID").click(function () {
$("[name=SysCheckbox]:checkbox").each(function (i, u) {
$(u).prop("checked", true);
});
});
      //取消全选
$("#SysAllCancelID").click(function () {
$("[name=SysCheckbox]:checkbox").each(function (i, u) {
$(u).prop("checked",false);
});
});

html:

<a href="javascript:void(0);" class="Batch_a" id="SysAllSelectedID">全选</a>
<a href="javascript:void(0);" class="Batch_a" id="SysAllCancelID">取消全选</a> <input type="checkbox" name="SysCheckbox" class="bx_hun" />
<input type="checkbox" name="SysCheckbox" class="bx_hun" />
<input type="checkbox" name="SysCheckbox" class="bx_hun" />