: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").
Prefix with input, scope to a form, then count, style, or toggle.
Write $("input:checkbox") — not bare $(":checkbox").
Scope when you can: $("form input:checkbox").
For speed: $("input[type='checkbox']") (official tip).
Combine with :checked when you need only selected boxes.
Piece
Required?
Role
Selector string
Yes
:checkbox (best as input:checkbox)
Tag prefix
Recommended
Avoids implied * universal scan
Form / context
Recommended
Avoids checkboxes in unrelated widgets
Return value
—
jQuery collection of checkbox inputs (may be empty)
Pseudocode
Pseudocode
matches = []
for each element in search context:
if element.type is "checkbox":
matches.add(element)
return matches
// Faster pattern:
return querySelectorAll("input[type='checkbox']")
Reference
Cheat Sheet
Keep these facts handy while selecting checkbox inputs.
Topic
Detail
Syntax
$("input:checkbox") / $("form input:checkbox")
Since
jQuery 1.0 · jQuery extension
Matches
input[type=checkbox]
Equivalent
$("[type=checkbox]")
Native CSS
$("input[type='checkbox']")
Avoid
Bare $(":checkbox") (implies *)
vs :radio
Different type — never overlaps
Official demo
$("form input:checkbox") → count 2
Try it
Live Preview
Run different selectors against a small sample form and see which checkbox inputs match.
Sample markup mirrors the official jQuery form demo (two checkboxes plus radio, text, and a button).
Result
$("input:checkbox")
matched: 2
values: one, two
/* recommended — tag + :checkbox */
Code
jQuery Examples
Short, copy-ready snippets. Open a browser with jQuery loaded, or use Try It Yourself for a live editor.
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.
Guard.preventDefault stops accidental form submit in the demo.
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.
Habit. Prefer the CSS form in performance-sensitive code.
Example 4 — :checkbox vs :radio
These pseudo-classes never overlap — each matches one input type.
jQuery
console.log(":checkbox →", $("input:checkbox").length);
console.log(":radio →", $("input:radio").length);
// Checkboxes and radios are separate type filters
Select.form input:checkbox gathers every box in the form.
Exclude self..not(this) skips the master when updating others (optional).
Sync..prop("checked", …) sets the checked state in one call.
Edge Cases & Pitfalls
Check these before relying on :checkbox in real forms.
slow
Bare $(":checkbox") implies *
Official tip: write $("input:checkbox") so the universal selector is not implied.
non-std
Not valid in querySelectorAll
Prefer $("input[type='checkbox']") for native speed.
trap
Radios are not checkboxes
Use :radio for radio inputs — the two selectors never overlap.
state
:checkbox ≠ checked state
It selects all checkboxes, checked or not. Add :checked when you need only selected ones.
Compatibility
Browser Support
The :checkbox pseudo-class is a jQuery extension and has worked since jQuery 1.0. Prefer the CSS equivalent input[type="checkbox"] for native querySelectorAll performance.
✓ jQuery 1.0+ · extension
jQuery :checkbox Selector
Supported across jQuery 1.x, 2.x, and 3.x wherever your jQuery build runs. Prefer input:checkbox; use input[type='checkbox'] for speed.
100%jQuery extension
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
:checkboxUniversal
Bottom line: Safe everywhere jQuery runs. Always prefix with input; prefer the attribute selector when performance matters.
Analysis
Performance Notes
Approach
Cost
Best for
$("input[type='checkbox']")
Fastest
Native CSS (official tip)
$("form input:checkbox")
Cheap
Typical tutorials and small pages
$("input:checkbox")
OK
Page-wide checkbox lists
$(":checkbox")
Slower
Avoid — implies *:checkbox
Official jQuery docs note that because :checkbox is not CSS, it cannot use the querySelectorAll boost. Use [type="checkbox"] instead when speed matters.
Remember
Key Takeaways
Role: match every input[type=checkbox].
Prefix: write $("input:checkbox"), not bare $(":checkbox").
Speed: prefer $("input[type='checkbox']").
Not state: add :checked when you need selected boxes only.
One line: use $("input:checkbox") (or the CSS attribute form) to gather checkboxes — never confuse it with :radio or :checked.
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.