vendredi 25 août 2017

jquery check-uncheck checkbox [duplicate]

This question already has an answer here:

When I click on Problem, both check boxes must select/deselect. I want to select and deselect check boxes for multiple time. It works only for selecting and then deselecting (2 times) and then is not working any more.

check boxes

My code:

 $(document).ready(function() {
        $('#CHECK-ALL').click(function() {
            if ($(this).is(':checked')) {
                $('#P').attr('checked',true);                
            } else {
                $('#P').attr('checked',false);                
            }
        });
    });




Aucun commentaire:

Enregistrer un commentaire