<script> //实现全选与反选 $(".allandnotall").click(function () { if ($(this).prop("checked")) { $("input[id=inlinecheckbox1]:checkbox").each(function () { $(this).prop("checked", true); }); } else { $("input[id=inlinecheckbox1]:checkbox").each(function () { $(this).prop("checked", false); }); } }); //当其中不勾选某一个选项的时候,则去掉全选复选框 $(":checkbox[id=inlinecheckbox1]").click(function () { $(".allandnotall").prop('checked', $(":checkbox[id=inlinecheckbox1]").length == $(":checkbox[id=inlinecheckbox1]:checked").length); }); </script>
<!-- 全选按钮 --> <label for="exampleinputemail2">全选</label> <input type="checkbox" class="allandnotall"> <!-- 单选框 --> <td><input type="checkbox" value="{{ data.id }}" name="product_bound_id" id="inlinecheckbox1"></td>
如对本文有疑问, 点击进行留言回复!!
20200716——gitlab实操记录/精通git阅读笔记/prop
JQuery DataTables根据行数据不同而行或列的更改颜色
VScode中的react自动补全标签代码及黄色or红色警告
网友评论