$(".myCheckbox").attr('checked', true); // Deprecated $(".myCheckbox").prop('checked', true);
Check if the checkbox is checked
There are several ways to get to work out if a checkbox is checked or not with jQuery, and here a couple of alternatives. Each will return true if it’s checked or false if it’s not.
$('.myCheckbox').is(':checked'); $('.myCheckbox').attr('checked');