How do I check whether a checkbox is checked in jQuery?

The jQuery prop() method provides a simple, effective, and reliable way to track down the current status of a checkbox. It works pretty well in all conditions because every checkbox has a checked property which specifies its checked or unchecked status.

$("#mycheckbox").change(function() {
    var value = $(this).prop("checked") ? 'true' : 'false';                     
    alert(value);
});

Leave a Reply

Your email address will not be published. Required fields are marked *