How do you check whether a checkbox is currently checked in jQuery? | A1Lab@FahadM to JavaScriptEnglish •
edit-2
12 days ago

How do you check whether a checkbox is currently checked in jQuery?

message-square
0

Use **.is(“:checked”)** or **.prop(“checked”)** on the jQuery selector—both return a clean boolean (trueorfalse`) reflecting the live DOM state of the checkbox.

Check Checkbox State in jQuery

// Method 1: .is(':checked') (Most readable)
if ($("#agreeTerms").is(":checked")) {
  console.log("Checkbox is checked!");
}

// Method 2: .prop('checked') (Direct DOM property lookup)
const isChecked = $("#agreeTerms").prop("checked");

Avoid .attr("checked")

.attr("checked") only reads the initial HTML attribute from page load and does not update when the user clicks the checkbox. '