jquery default checked code example

Example 1: jquery set checkbox checked

<script>
	//jQuery 1.6+ use
	$('#checkbox').prop('checked', true);

	//jQuery 1.5.x and below use
	$('#checkbox').attr('checked', true);
</script>

Example 2: checkbox default value and checked value get in jquery

//selected checkbox alert boolen value return
$('#test').click(function() {
    alert("Checkbox state (method 1) = " + $('#test').prop('checked'));
    alert("Checkbox state (method 2) = " + $('#test').is(':checked'));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Check me: <input id="test" type="checkbox" />
  //@sujaY