jQuery checkboxes

May 15, 2012 by Jean

Very useful reference at http://technosophos.com/node/223 on how to properly manipulate checkboxes with jQuery.

Cured my headache better than Advil.

Check if a checkbox is checked


Check a checkbox

Following the HTML spec, the attribute must be set to checked="checked" (not just checked).


Uncheck a checkbox


Check / Uncheck all checkboxes

$(':checkbox:not(:checked)').attr('checked', 'checked');

In: Javascript