Setting “checked” for a checkbox in jQuery?

jQuery 1: find element by id

$("#element_id").prop("checked", true); // find element by id, check
$("#element_id").prop("checked", false); // find element by id. uncheck

If you're working with just one element, you can always access the underlying HTMLInputElement and modify its .checked property:

$("#element_id")[0].checked = true; // check
$("#element_id")[0].checked = false; // uncheck

jQuery 2: find element by class

$(".element_class").prop("checked", true); // find element by CSS class, check
$(".element_class").prop("checked", false); // find element by CSS class, uncheck