jquery make checkbox checked code example

Example 1: jquery set checkbox checked

//jQuery 1.6+ use
$('.checkbox').prop('checked', true);
//jQuery 1.5.x and below use
$('.checkbox').attr('checked', true);

Example 2: jquery set checkbox checked unchecked

//jQuery 1.6+ use
$('.checkbox').prop('checked', true);  //false for uncheck
//jQuery 1.5.x and below use
$('.checkbox').attr('checked', true);  //false for uncheck

Example 3: jquery checkbox checked

$("checkbox").is(":checked")

Example 4: jquery in checkbox checked

// Check a checkbox
$(selector).prop('checked', true);
// Un-check a checkbox
$(selector).prop('checked', false);
// Determine if checked or not
isChecked = $(selector).prop('checked');

Example 5: set checkbox checked jquery

$("#checkboxid").attr('checked', true);

Example 6: jquery checkbox checked

$("#general_no").prop( "checked", true);