jquery 中全选checkbox
JavaScript部分:
function checkAll(obj){
$("#box input[type='checkbox']").prop('checked', $(obj).prop('checked'));
}
html部分:
<div id="box">
<input type="checkbox" onclick="checkAll(this)">全选<br><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
<input type="checkbox"><br>
</div>
原文链接:https://blog.csdn.net/nh2r1114/article/details/129893499
本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/17586154.html