This question already has an answer here:
- How to retrieve checkboxes values in jQuery 16 answers
I am looking to get all checkboxes\' VALUE which have been selected through jQuery.
This question already has an answer here:
I am looking to get all checkboxes\' VALUE which have been selected through jQuery.
You want the :checkbox:checked
selector and map
to create an array of the values:
var checkedValues = $(\'input:checkbox:checked\').map(function() {
return this.value;
}).get();
If your checkboxes have a shared class it would be faster to use that instead, eg. $(\'.mycheckboxes:checked\')
, or for a common name $(\'input[name=\"Foo\"]:checked\')