KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to count how many checkboxes on my page are selected using jQuery. I've written the following code: var numberOfCheckboxesSelected = 0; $(':checkbox').each(function(checkbox) { if (checkbox.attr('checked')) numberOfCheckboxesSelected++; }); However, my code errors out with the message "Object doesn't support this property or method" on the third line. How do I count how many checkboxes are selected on my page?
Tags (comma-separated)
Save Edits
Cancel