Lana
0
Q:

jquery set checkbox

//jQuery 1.6+ use
$('.checkbox').prop('checked', true);
//jQuery 1.5.x and below use
$('.checkbox').attr('checked', true);
5
//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
<script>
	//jQuery 1.6+ use
	$('#checkbox').prop('checked', true);

	//jQuery 1.5.x and below use
	$('#checkbox').attr('checked', true);
</script>
2
$('#grepperRocks').prop('checked', true);
9
// Check #x
$( "#x" ).prop( "checked", true );
 
// Uncheck #x
$( "#x" ).prop( "checked", false );
1

New to Communities?

Join the community