JS的选择操作
<script>
全选 true
$("#selectAll").click(function(){
$(".item").prop("checked",true);
});
全不选 flase
$("#selectNone").click(function(){
$(".item").prop("checked",false);
});
这个是得到当前的所有选项 遍历得到每一项this
$(this).prop("checked")得到当前的值 取反再赋值
$("#reverse").click(function(){
let items =$(".item");
items.each(function(){
$(this).prop("checked",!$(this).prop("checked"));
})
});
</script>