I have collection of inputs of type checkbox
var collection = $(\'.className\');
console.log(collection);
result is:
[span.clas
You can use the :checked selector, and then check the length
property to see if any elements were matched:
if ($(".className:checked").length) {
//At least 1 is checked!
}
However, your output looks like you have span
elements, not input
elements. If the checkboxes are descendants of the .className
elements, add a space before the :checked
selector.