lundi 4 mai 2015

to add a class when all checkboxes are checked

I'm trying to add a "disabled" class to my button when all the checkboxes are checked and when none of them are checked.

Was able to figure out when none of them are check:

var SummaryCheckBox = function() {
    $(':checkbox').click(function () {
        $('.btn-primary').toggleClass('disabled', !$(':checkbox:checked').length);
    });
}

But having a hard time checking when all the checkboxes are checked. Suggestions?




Aucun commentaire:

Enregistrer un commentaire