jQuery :radio Selector

Beginner
7 min read
Updated: Oct 2026
5 examples
Live preview

What Is :radio?

:radio (since jQuery 1.0) selects every <input type="radio"> — the one-choice-per-group controls used in surveys, settings, and checkout. Official docs state it is equivalent to [type=radio]. Always prefer $("input:radio") over bare $(":radio").

Remember
$("input:radio")                 // all radio inputs
$("form input:radio")            // radios inside a form
$("input[name=gender]:radio")    // one radio group (official)
$("input[type=radio]")           // equivalent attribute form

// Avoid on large pages:
$(":radio")                      // implies *:radio
NeedUse
All radios$("input:radio")
One group$("input[name=x]:radio")
Selected radio$("input[name=x]:radio:checked")
Native speed$("input[type=\"radio\"]")
Checkboxes instead$("input:checkbox")

How to Use :radio

Prefix with input, scope to a form or name, then style, count, or bind events.

  1. Write $("input:radio") — never bare $(":radio") on large pages.
  2. Scope to a form: $("#survey input:radio").
  3. Target one group with the official pattern: $("input[name=gender]:radio").
  4. Read the selected option with :checked and .val().
  5. For hot paths, prefer input[type="radio"] so the browser can optimize.
PieceRequired?Role
Selector stringYes:radio filter (best with an input prefix)
name attributeOptionalLimits matches to one mutually exclusive group
Form / contextOptionalAvoids radios in unrelated widgets
Return value—jQuery collection of matching radio inputs (may be empty)

Pseudocode

Pseudocode
matches = []
for each element in search context:
    if element.tag is input
       and element.type is "radio":
        matches.add(element)

return matches

// Official group filter:
keep only matches where name == "gender"

Cheat Sheet

Keep these facts handy while selecting radio buttons.

TopicDetail
Syntax$("input:radio")
SincejQuery 1.0 · jQuery extension
Equivalent$("[type=radio]")
Matchesinput type="radio" only
Group scopeinput[name=group]:radio
vs :checkboxDifferent type — no overlap
Selected oneinput:radio:checked
Native CSSUse [type="radio"] for speed

Live Preview

Run different selectors against a small sample form and see how many radios match.

Sample markup mirrors the official jQuery form demo (button, checkbox, radios, text).

Result
$("form input:radio")
matched: 3

/* radios only — checkboxes and text ignored */

jQuery Examples

Short, copy-ready snippets. Open DevTools Console with jQuery loaded, or use Try It Yourself for a live editor.

Example 1 — Official Demo: form input:radio

Wrap radios in styled spans and print the match count (jQuery API example).

jQuery
var input = $("form input:radio")
  .wrap("<span></span>")
  .parent();

$("#count").text("For this type jQuery found " + input.length + ".");
Try It Yourself

How It Works

  1. Scope. form input:radio searches radios inside the form only.
  2. Filter. Only type="radio" matches — other inputs are ignored.
  3. Wrap. Each match gets a <span> parent for styling.
  4. Report. .length is how many radios were found.

Example 2 — Equivalence: :radio vs [type=radio]

Official docs — both forms select the same elements.

jQuery
var a = $("input:radio").length;
var b = $("input[type=radio]").length;

console.log("input:radio →", a);
console.log("[type=radio] →", b);
console.log("same set?", a === b);
Try It Yourself

How It Works

  1. Pseudo. :radio is the jQuery shorthand for radio-type inputs.
  2. Attribute. [type=radio] is the standard CSS equivalent.
  3. Compare. Matching lengths mean both forms found the same nodes.
  4. Choose. Prefer the attribute form when native speed matters.

Example 3 — input:radio vs input:checkbox

Mark each control type separately — the selectors never overlap.

jQuery
$("input:radio").closest("label").each(function () {
  this.appendChild(document.createTextNode(" [radio]"));
});
$("input:checkbox").closest("label").each(function () {
  this.appendChild(document.createTextNode(" [checkbox]"));
});

console.log("radios:", $("input:radio").length);
console.log("checkboxes:", $("input:checkbox").length);
Try It Yourself

How It Works

  1. Type filter. :radio keeps radio inputs only.
  2. Other type. :checkbox keeps checkbox inputs only.
  3. No overlap. A control never matches both selectors.
  4. Label text. Appending a marker on the closest label makes the split obvious.

Example 4 — Group Scope: input[name=gender]:radio

Official docs pattern — listen to one mutually exclusive group by name.

jQuery
$("input[name=gender]:radio").on("change", function () {
  $("#out").text("Selected: " + this.value);
});

// size radios share a different name — not affected
Try It Yourself

How It Works

  1. Name filter. [name=gender] limits the set to one HTML radio group.
  2. Type filter. :radio confirms radio-type inputs.
  3. Change. The handler runs when the user picks a gender option.
  4. Isolation. Radios with another name never fire this handler.

Example 5 — Native Performance: input[type="radio"]

Official tip — use the attribute selector so modern browsers can optimize.

jQuery
var $radios = $("input[type='radio']");
$("#out").text("Found " + $radios.length + " radio(s) via [type=radio]");

// Pure DOM (no jQuery pseudo-class):
// document.querySelectorAll("input[type='radio']")
Try It Yourself

How It Works

  1. Standard CSS. [type="radio"] is valid in native selectors.
  2. Same matches. You still get every radio input.
  3. Engine boost. jQuery can hand the query to querySelectorAll.
  4. When to switch. Prefer this form on large pages or hot update paths.

Edge Cases & Pitfalls

Check these before relying on :radio in real forms.

slow

Bare $(":radio") scans everything

It implies *:radio. Prefer $("input:radio") or a form-scoped query.

non-std

Not valid in querySelectorAll

:radio is a jQuery extension. Use input[type="radio"] for native CSS queries.

group

Same page, many groups

Radios only exclude each other when they share a name. Scope with input[name=…]:radio.

state

:radio ≠ selected

:radio matches every radio. For the chosen one, add :checked.

Browser Support

The :radio pseudo-class is a jQuery extension and has worked since jQuery 1.0. The equivalent input[type="radio"] attribute selector is standard CSS and runs in native querySelectorAll.

✓ jQuery 1.0+ · extension

jQuery :radio Selector

Supported across jQuery 1.x, 2.x, and 3.x wherever your jQuery build runs. Prefer input:radio; use input[type="radio"] for native speed.

100% jQuery + native attr
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
:radio Universal

Bottom line: Safe everywhere jQuery runs. Scope groups with input[name=group]:radio; prefer [type="radio"] when performance matters.

Performance Notes

ApproachCostBest for
$("input[type=\"radio\"]")FastestModern browsers / hot paths
$("input:radio")CheapTypical tutorials and small forms
$("#form input:radio")CheaperMulti-form pages
$(":radio")SlowerAvoid — universal scan

Official jQuery docs note that because :radio is not CSS, it cannot use the querySelectorAll boost. Prefer [type="radio"] when the page is large or you re-query often.

Key Takeaways

  • Role: select every input type="radio" in scope.
  • Prefix: use $("input:radio"), not bare $(":radio").
  • Groups: input[name=…]:radio targets one mutually exclusive set.
  • Speed: prefer [type="radio"]; for the chosen option use :checked.

One line: $("input:radio") finds radio buttons — scope by form or name, and use [type="radio"] when you need native speed.

Frequently Asked Questions

:radio selects every input whose type is radio — mutually exclusive options in a form group. $("input:radio") finds all radio buttons in the search context. Available since jQuery 1.0.
Prefer $("input:radio"). Bare $(':radio') implies the universal selector and scans as $('*:radio'), which is slower on large pages. Official jQuery docs recommend prefixing with input or another selector.
Yes. Official docs state that :radio is equivalent to $('[type=radio]'). For native querySelectorAll performance in modern browsers, prefer input[type="radio"] over the :radio pseudo-class.
:radio matches input[type="radio"] only. :checkbox matches input[type="checkbox"] only. They never overlap — use the correct pseudo-class for each control type.
Official docs example: $("input[name=gender]:radio") selects radio buttons with name="gender" only. Combine the name attribute filter with :radio to target a single mutually exclusive group.
No. It is a jQuery extension (not part of the CSS specification), so queries using :radio cannot use the native querySelectorAll boost. Use [type="radio"] when performance matters.

Next: :file Selector

Learn how to select file upload inputs in forms with the :file selector.

:file tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful