lundi 21 septembre 2015

How to count all checkboxes that are checked into the entire DOM but that are shown in the page a piece at a time?

I have a table that contains a list of cities. Every row has a checkbox with "city" class.

Although in the source code of the page are present all cities, the table show only ten city at time (because I want so). In the bottom of table there is a button that shows the next cities.

I want to know how much checkboxes are checked.

So, I tried: $('.city').length, but this function counts only the checkboxes present in the table in that moment, and not the checkboxes that are effectively present in the dom (for example: in the dom are present 30 cities, the table shows only 10 cities at time. The function above returns 10).

How can I count all checkboxes that are checked?




Aucun commentaire:

Enregistrer un commentaire