I’m getting the following syntax error for my list of check boxes:
unrecognized expression: input:checked[name=match_list[]]
HTML:
<label class="checkbox">
<input type="checkbox" name="match_list[]" value="10">
Item 10
</label>
<label class="checkbox">
<input type="checkbox" name="match_list[]" value="20">
Item 20
</label>
jQuery:
var arr=[];
$('input:checked[name=match_list[]]').each(function(){
arr.push($(this).val());
});
Any idea what the error is pointing to? The syntax looks fine to me…
Use
The quotes are only optional when it’s easy to parse.
Regarding the input elements inside the label elements (a problem seen by Brian), you should use the for attribute :