javascript - Count all checkboxes that are checked in the entire DOM even when they are not displayed with DataTable? -


i have table contains list of cities. every row has checkbox city class.

although cities present in source code of page table show ten city @ time (because want so). in bottom of table there button shows next cities.

i want know how many checkboxes checked.

so, tried $('.city').length, function counts checkboxes present in table @ moment, , not checkboxes present in dom. (for example: in dom there 30 cities present, table shows 10 cities @ time. function above returns 10.)

how can count checkboxes checked?

update:

using datatable, solved with:

var nodes = $('#table').datatable().rows().nodes();

with rows of table.

try this:

$('input:checkbox:checked').length 

for city can following

$('input:checkbox.city:checked') 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -