Thursday, 3 August 2017

All check box check on click one check box in JQUERY




Html:
<input class='allcheck'  name="check_all" type='checkbox' />All check box


<input class='check'   type='checkbox' />on
<input class='check'   type='checkbox' />of
<input class='check'   type='checkbox' />yes

Jquery function:
 <script>

        $(document).on('click change', 'input[name="check_all"]', function () {
            var checkboxes = $('.check');
            if ($(this).is(':checked')) {
                checkboxes.each(function () {
                    this.checked = true;
                });
            } else {
                checkboxes.each(function () {
                    this.checked = false;
                });
            }
        });
    </script>

No comments:

Post a Comment