Checking Whether a Checkbox is Checked with Jquery

Checking Whether a Checkbox is Checked with Jquery

Last updated:

Say you have a checkbox whose id is "my-checkbox":

checkbox is checked

$("#my-checkbox").attr("checked");

returns "checked"

$("#my-checkbox").prop("checked");

returns true

checkbox is NOT checked

$("#my-checkbox").attr("checked");

returns undefined

$("#my-checkbox").prop("checked");

returns false