Find all unchecked checkboxes in jQuery

I have a list of checkboxes:

<input type="checkbox" name="answer" id="id_1' value="1" />
<input type="checkbox" name="answer" id="id_2' value="2" />
...
<input type="checkbox" name="answer" id="id_n' value="n" />

I can collect all the values of checked checkboxes; my question is how can get all the values of unchecked checkboxes? I tried:

$("input:unchecked").val();

to get an unchecked checkbox’s value, but I got:

Syntax error, unrecognized expression: unchecked.

Can anybody shed a light on this issue?
Thank you!

8 Answers
8

Leave a Comment