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
Post a Comment