:checkbox (since jQuery 1.0) selects every element of type checkbox — almost always <input type="checkbox">. Official equivalent: $("[type=checkbox]"). Prefer $("input:checkbox") or $("input[type='checkbox']") over a bare $(":checkbox").
Syntax
Start with these common calls. Keep them short and readable.
jQuery collection of checkbox inputs (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
Write $("input:checkbox") — not bare $(":checkbox").
Step 2
Scope when you can: $("form input:checkbox").
Step 3
For speed: $("input[type='checkbox']") (official tip).
Return Value
Return Value
Description
See examples
Check the examples below for what this API returns in common cases.
jQuery Examples
Example 1 — Official Demo: Count Checkboxes
Find every checkbox in a form and report the count (jQuery API example).
jQuery
var input = $("form input:checkbox");
$("div").text("For this type jQuery found " + input.length + ".");
// Prevent the form from submitting
$("form").on("submit", function (event) {
event.preventDefault();
});
For this type jQuery found 2.
(two checkbox inputs in the sample form)
How It Works
Scope.form input:checkbox limits the search to one form.
Filter. Only type="checkbox" inputs match.
Count..length is written into a message.
Example 2 — Prefer input:checkbox
Bare :checkbox implies *:checkbox — always prefix with a tag.
jQuery
console.log("prefixed →", $("input:checkbox").length);
console.log("bare →", $(":checkbox").length);
// Same count here, but bare form scans every element type
true
Same result set; CSS form uses querySelectorAll
How It Works
Same intent. Both selectors target checkbox inputs.
Native path.[type='checkbox'] can use querySelectorAll.
Extension cost. Bare :checkbox cannot use that boost.
Frequently Asked Questions
:checkbox selects every element whose type is checkbox — almost always input[type="checkbox"]. It does not select radio buttons, text fields, or other control types.
Prefer $("input:checkbox"). Bare $(":checkbox") implies the universal selector and scans as $("*:checkbox"), which is slower on large pages. Official jQuery docs recommend prefixing with a tag name.
No. It is a jQuery extension since version 1.0. It is equivalent to $("[type=checkbox]"). For native querySelectorAll performance, use input[type="checkbox"] instead.
:checkbox matches input[type="checkbox"] only. :radio matches input[type="radio"] only. They never overlap — use the correct pseudo-class for each control group.
In the official jQuery form demo, $("form input:checkbox") finds two checkbox inputs, wraps them, and reports "For this type jQuery found 2."
Yes. A common pattern is $("#checkAll").on("change", function () { $("form input:checkbox").not(this).prop("checked", this.checked); }) — scope to your form so you do not toggle checkboxes elsewhere.