[removed] Unchecking all checkboxes

后端 未结 6 890
独厮守ぢ
独厮守ぢ 2021-01-18 07:42

I have problem dealing with unchecking all checkboxes. When I click on a toggle all checkbox, it could check all checkboxes. But if I uncheck the toggle all checkbox, nothin

6条回答
  •  温柔的废话
    2021-01-18 07:53

    You can do this with jQuery very easy and more understandable :)

    $('#mybutton').click(function(e) {
        $('.myCheckboxes').each(function(i,item){
            $(item).attr('checked', !$(item).is(':checked'));
        });
    });
    

    Try on jsFiddle

提交回复
热议问题