How to clear all checkbox When checkbox id=“checkAll” are checked?

后端 未结 4 1863
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-25 23:04

How to clear all checkbox When checkbox id=\"checkAll\" are checked ?

in my demo , when user checked checkbox id=\"checkAll\" all checkbox are

4条回答
  •  野的像风
    2021-01-25 23:42

    Just apply the negation of this.checked

    $('#checkAll').change(function () {    
         $('input:checkbox').not(this).prop('checked', !this.checked);       
     });
    

    Demo

提交回复
热议问题