Checking and unchecking, or ticking and unticking if you prefer, checkboxes using jQuery is remarkably simple.

If you think about it, the checked attribute for a standard HTML checkbox is actually a deprecated “checked = true” and by leaving it out in your checkbox declaration, you are in actual fact setting “checked = false” on that input.

So in order to check a checkbox with jQuery you simple select the checkbox input to be affected and enter:

$('input[name=foo]').attr('checked', true);

Alternatively, to uncheck you actually physicall remove the checked attribute:


Pretty simple stuff eh? ;)