Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to count CheckBoxList checked using Jquery

I have search with the following keyword but couldn't find.

javascript CheckBoxList api

jquery CheckBoxList checked count

like image 218
Sarawut Positwinyu Avatar asked Jun 13 '11 10:06

Sarawut Positwinyu


1 Answers

The following should give you the total number of checked checkboxes on the page

var count = $(':checkbox:checked').length;

If you want to restrict it only to a given CheckBoxList you could assign this checkboxlist some class and then:

var count = $('.someClass :checkbox:checked').length;
like image 64
Darin Dimitrov Avatar answered Sep 20 '22 22:09

Darin Dimitrov