单选去掉选中的,全选切换状态

  •   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"));
            }
        })
    

      

    这是第一个选择框
  • 这是第二个选择框
  • 这是第三个选择框
  • 这是第四个选择框
posted @ 2018-04-17 16:05  章晓鱼  阅读(275)  评论(0)    收藏  举报