jQuery: How to check and uncheck a Checkbox CodeUnit 10 FEB 2010

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? ;)

About Craig Lotter

Software developer, husband and dad to two young ladies. Writer behind An Exploring South African. I don't have time for myself any more.