tmaster
tmaster

Reputation: 9655

How to check if a checkbox is unchecked?

I know I can use :checkbox:checked to get a list or an array whichever you'd like to call it with all the checkboxes which are checked.

But is there a function to get an unchecked list? (like :checkbox:unchecked which does not seem a valid function) I don't want to loop through each element using .is(":checked").

Thanks.

Upvotes: 1

Views: 15354

Answers (2)

eyurdakul
eyurdakul

Reputation: 912

you can try this selector,

var unchecked_checkboxes = $(".checkbox").not(":checked");

i assume your checkboxes have the class "checkbox".

Upvotes: 1

dku.rajkumar
dku.rajkumar

Reputation: 18568

try this

$(':checkbox:not(:checked)')

Upvotes: 6

Related Questions