单选去掉选中的,全选切换状态
-
ul,li{ list-style: none; } .disNo{ display: none; }$(".danXuan").on("click",function () { $("input[type='checkbox']:checked").each(function () {//循环已选中的input $(this).parent("li").addClass("disNo"); }) }) $(".quanXuan").on("click",function () { if($("input[type='checkbox']").attr("checked")!="checked"){ $("input[type='checkbox']").attr("checked","checked"); }else{ $("input[type='checkbox']").removeAttr(("checked")); } })
这是第一个选择框 - 这是第二个选择框
- 这是第三个选择框
- 这是第四个选择框

浙公网安备 33010602011771号