jeudi 22 décembre 2016

Jquery Exclude a checkbox from select all

My HTML code to select all checkboxes

Select All <input type="checkbox"  name='select_all' id='select_all'  value='1'/>

My Javascript code to select all checkboxes

<script type="text/javascript">
    $('#select_all').change(function() {
    var checkboxes = $(this).closest('form').find(':checkbox');
    if($(this).is(':checked')) 
    {
       checkboxes.prop('checked', true);
                } else {
        checkboxes.prop('checked', false);
        }
    });
    </script>

The code works great and selects all the checkboxes, I would like to exclude the following checkbox from the selection (select all) criteria, is it possible to exclude the following?

 <input type="checkbox"  name='sendtoparent' id='sendtoparent'  value='1'/>




Aucun commentaire:

Enregistrer un commentaire