checkout 多选 全选(亲测有效)
<input type="button" id="btn1" value="全选"> <input type="button" id="btn2" value="取消全选"> <input type="checkbox" name="building_id[]" value="checkbox1"> checkbox1 <input type="checkbox" name="building_id[]" value="checkbox2"> checkbox2
js部分
{{--全选--}} $("document").ready(function(){ $("#btn1").click(function(){ $("[name='building_id[]']").prop("checked",'true');//全选 }) $("#btn2").click(function(){ $("[name='building_id[]']").prop("checked", false); //取消全选 }) })
赞赏码
![](https://files.cnblogs.com/files/lxwphp/zhifubao2.bmp)
![](https://files.cnblogs.com/files/lxwphp/weixin.bmp)
非学,无以致疑;非问,无以广识