Skip to content

Checking a checkbox with jQuery?

$(".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');
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments