:checked (since jQuery 1.0) matches elements that are checked or selected right now — ticked checkboxes, the active radio in a group, and selected <option> elements. It is a standard CSS pseudo-class that jQuery supports in $() queries.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$("input:checked") // checked inputs now
$("input:checkbox:checked") // ticked checkboxes only
$("input[name=fruit]:checked") // selected radio in a group
$("option:checked") // selected options
// For select-only queries, prefer :selected
// Toggle state with .prop("checked", true/false)
Call
What it does
Selector string
:checked filter (best with a tag prefix)
Context / form id
Limits the search to one form or container
Event handler
Refresh counts/values after user interaction
Return value
jQuery collection of matching elements (may be empty)
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Prefix with a tag or type: $("input:checked") or $("input:checkbox:checked").
Step 2
Scope to a form when the page has many controls: $("#form input:checked").
Step 3
Read radio/checkbox values with .val() on the matched set.
Return Value
Return Value
Description
Boolean
Often true or false depending on the match or state.
jQuery Examples
Example 1 — Count Checked Inputs
Official idea: count input:checked and update the message on click.
jQuery
var countChecked = function () {
var n = $("input:checked").length;
$("#count").text(n + (n === 1 ? " is" : " are") + " checked!");
};
countChecked();
$("input[type=checkbox]").on("click", countChecked);
Click apple → "apple is checked!"
Click banana → "banana is checked!"
How It Works
Group. Radios share a name, so only one can be checked.
Match.$("input:checked") finds that one radio.
Value..val() returns its value attribute.
Frequently Asked Questions
:checked matches form controls that are currently checked or selected — ticked checkboxes, the active radio in a group, and selected option elements. It reflects live DOM state, not only the initial HTML checked attribute.
:checkbox matches every checkbox input regardless of state. :checked matches only controls that are checked/selected right now. Use $("input:checkbox:checked") for checked checkboxes only. Note: :checkbox is a jQuery extension; :checked is standard CSS.
Yes. In a radio group, :checked matches the one radio that is selected. $("input[name=fruit]:checked").val() returns that option’s value.
Use :checked to find matching elements (count, style, iterate). Use .prop("checked", true/false) to read or change the checked state on a specific element. Prefer .prop over .attr for boolean form state.
Yes. :checked is a CSS pseudo-class (Selectors Level 3 / HTML). jQuery supports it since 1.0. Prefer $("input:checked") over bare $(":checked") so the query does not scan every element.
:checked matches selected options inside a select. For select-only queries, jQuery also provides :selected — use it when you want options without matching checkboxes or radios.