Select all Checkbox in Javascript

Select all Checkbox in Javascript::
<script type=”text/javascript”>
$(document).ready(function(){
$(“#checkbx_selectall”).on(‘change’, function() {
if(this.checked){
            $(‘.__chckbx_select’).each(function(){
                this.checked=true;
            });
        }else{
             $(‘.__chckbx_select’).each(function(){
                this.checked=false;
            });
        }
    });
    $(‘.__chckbx_select’).on(‘change’,function(){
        if($(‘.__chckbx_select:checked’).length == $(‘.__chckbx_select’).length){
            $(‘#checkbx_selectall’).prop(‘checked’,true);
        }else{
            $(‘#checkbx_selectall’).prop(‘checked’,false);
        }
    });
});
</script>

2 thoughts on “Select all Checkbox in Javascript”

  1. I’m no longer positive where you are getting your information, but great topic.
    I needs to spend some time learning much more or understanding more.

    Thanks for great info I used to be in search of this information for my
    mission.

Leave a Reply

Your email address will not be published. Required fields are marked *