How to uncheck checkbox using jQuery Uniform library

后端 未结 12 2169
再見小時候
再見小時候 2021-01-29 22:04

I have a problem with unchecking a checkbox. Have a look at my jsFiddle, where I am attempting:

   $(\"#check2\").attr(\"checked\", true);
<         


        
12条回答
  •  失恋的感觉
    2021-01-29 23:01

     $("#checkall").change(function () {
                var checked = $(this).is(':checked');
                if (checked) {
                    $(".custom-checkbox").each(function () {
                        $(this).prop("checked", true).uniform();
                    });
                } else {
                    $(".custom-checkbox").each(function () {
                        $(this).prop("checked", false).uniform();
                    });
                }
            });
    
            // Changing state of CheckAll custom-checkbox
            $(".custom-checkbox").click(function () {
                if ($(".custom-checkbox").length == $(".custom-checkbox:checked").length) {
                    $("#chk-all").prop("checked", true).uniform();
                } else {
                    $("#chk-all").removeAttr("checked").uniform();
                }
            });
    
     Select All
    PHP
    AngularJS
    Python
    Java

提交回复
热议问题