0
Q:

checkbox set checked jquery

//jQuery 1.6+ use
$('.checkbox').prop('checked', true);
//jQuery 1.5.x and below use
$('.checkbox').attr('checked', true);
5
$('.myCheckbox').prop('checked', true);
$('.myCheckbox').prop('checked', false);
1
//using plane javascript 
if(document.getElementById('on_or_off_checkbox').checked) {
    //I am checked
} 

//using jQuery
if($('#on_or_off_checkbox').is(':checked')){
    //I am checked
}
21
if ($('#check_id').is(":checked"))
{
  // it is checked
}
9
//For jQuery 1.6 and above
$('#myCheckBoxID').prop('checked', true);
//For jQuery Before 1.6
$('#myCheckBoxID').attr('checked','checked');
2
//jQuery 1.6+ use:
$('.checkboxClass').prop('checked', true);
//jQuery 1.5.x and below use:
$('.checkboxClass').attr('checked', true);
5
$(your_checkbox).is(':checked');
3
<script>
	//jQuery 1.6+ use
	$('#checkbox').prop('checked', true);

	//jQuery 1.5.x and below use
	$('#checkbox').attr('checked', true);
</script>
2
$("#checkboxid").prop('checked', true);  // Checks the box
$("#checkboxid").prop('checked', false); // Unchecks the box
2
// Check a checkbox
$(selector).prop('checked', true);
// Un-check a checkbox
$(selector).prop('checked', false);
// Determine if checked or not
isChecked = $(selector).prop('checked');
2

New to Communities?

Join the community