jquery checkbox checked change code example
Example 1: jQuery checkbox changed event
//jQuery listen for checkbox change
$("#myCheckBoxID").change(function() {
if(this.checked) {
//I am checked
}else{
//I'm not checked
}
});
Example 2: jquery checkbox set checked
//For jQuery 1.6 and above
$('#myCheckBoxID').prop('checked', true);
//For jQuery Before 1.6
$('#myCheckBoxID').attr('checked','checked');
Example 3: oncheck event jquery
$(".checkbox").change(function() {
if(this.checked) {
//Do stuff
}
});