vendredi 21 avril 2017

jQuery count of checkboxes through all pages

I want the count of checkboxes in all pages. Currently, I only have the count of checkboxes in the current page. When I go to second page, it goes back to zero and counts again.

Here is the code:

     $('[for-checkbox]').parent().find('input').on('change', function () {

    var total = 0;
    $('[for-checkbox]').parent().find('input').each(function () {
        if ($(this).is(':checked')) total++;
    });

    if (total > 0) $('[checkbox-callback]').html(total + ' counted');
    else $('[checkbox-callback]').html('');
});




Aucun commentaire:

Enregistrer un commentaire