The :radio selector matches every <input type="radio"> element — mutually exclusive options in form groups. Available since jQuery 1.0; equivalent to [type=radio]; always prefer input:radio over bare :radio.
01
Syntax
input:radio
02
type=radio
One choice
03
Official
Wrap + count
04
name=
Group scope
05
vs :checkbox
Different type
06
Native CSS
Faster query
Fundamentals
Introduction
Surveys, settings panels, and checkout flows use radio buttons when users must pick exactly one option from a set. jQuery’s :radio pseudo-class selects every input whose type attribute is radio.
Official jQuery documentation notes that :radio is equivalent to [type=radio], and recommends prefixing with input — bare $(":radio") implies $("*:radio"). To target one group, combine name with the pseudo-class: $("input[name=gender]:radio").
Concept
Understanding the :radio Selector
Think of :radio as a shortcut for radio-type inputs only:
input:radio → every radio button in scope.
input[name=size]:radio → one mutually exclusive group.
input:checkbox → different type — no overlap with :radio.
Only one radio per name can be checked at a time in standard HTML forms.
💡
Beginner Tip
Scope to your form: $("#survey input:radio") avoids styling radio buttons in unrelated modals on the same page.
Foundation
📝 Syntax
Official jQuery API form (since 1.0):
jQuery
jQuery( ":radio" )
// recommended — prefix with input:
$( "input:radio" )
$( "form input:radio" )
// one radio group (official docs example):
$( "input[name=gender]:radio" )
// equivalent attribute form:
$( "input[type=radio]" )
// native CSS (better performance):
document.querySelectorAll( 'input[type="radio"]' )
// avoid on large pages:
$( ":radio" ) // implies *:radio
Parameters
No arguments — keeps elements whose type is radio.
Return value
A jQuery object containing every matching radio input (zero or more).
Official jQuery API example
jQuery
var input = $( "form input:radio" )
.wrap( "<span></span>" )
.parent()
.css({ background: "yellow", border: "3px red solid" });
$( "div" ).text( "For this type jQuery found " + input.length + "." )
.css( "color", "red" );
Cheat Sheet
⚡ Quick Reference
Element
input:radio
input[type="radio"]
<input type="radio" name="a">
Matches
Matches
<input type="checkbox">
No match
No match
input[name=gender]:radio
One group
Use both filters
:checked on radios
Selected only
Combine selectors
Native querySelectorAll
Not supported
Supported
Compare
📋 :radio vs :checkbox and [type="radio"]
Mutually exclusive groups vs multi-select toggles.
:radio
input:radio
One choice per name
:checkbox
input:checkbox
Multi-select toggles
[type=radio]
input[type="radio"]
Native CSS — faster
:checked
input:radio:checked
Selected in group
Hands-On
Examples Gallery
Example 1 follows the official jQuery form input:radio demo. Examples 2–5 cover attribute equivalence, contrast with :checkbox, name-scoped groups, and the native performance pattern.
📚 Official jQuery Demo
Wrap every radio in a form and report how many matched.
Example 1 — Official Demo: form input:radio
Official jQuery demo — wrap radios in styled spans and display the match count in red.
jQuery
var input = $( "form input:radio" )
.wrap( "<span></span>" )
.parent()
.css({ background: "yellow", border: "3px red solid" });
$( "div" ).text( "For this type jQuery found " + input.length + "." )
.css( "color", "red" );
$( "form" ).on( "submit", function( e ) { e.preventDefault(); } );
Checkout — highlight shipping option radios on change.
Accessibility — pair with <label> elements per group.
Dynamic UI — enable/disable sections based on selected radio value.
Performance — prefer input[type="radio"] in hot paths.
🧠 How jQuery Evaluates :radio
1
Parse selector
Combine input with :radio — optionally add [name=...].
Query
2
Find candidates
Collect input elements in scope (or all elements if bare :radio).
Scan
3
Filter by type
Keep inputs where type attribute equals radio.
Match
4
✓
Return collection
Chain .prop(), .on("change"), or styling methods.
Important
📝 Notes
Available since jQuery 1.0 — equivalent to [type=radio].
jQuery extension only — not valid in native querySelectorAll(":radio").
Always use input:radio — bare :radio implies universal scan.
Official group pattern — input[name=gender]:radio.
Does not match checkboxes, text fields, or submit buttons.
Combine with :checked to read the selected option in a group.
Compatibility
Browser Support
The :radio pseudo-class is a jQuery extension and works in jQuery 1.0+. The equivalent input[type="radio"] attribute selector is standard CSS and runs in native querySelectorAll in all modern browsers.
✓ jQuery 1.0+ · extension
jQuery :radio Selector
Use input:radio in jQuery; use input[type="radio"] for native speed.
100%jQuery + native attr
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
:radioUniversal
Bottom line: Scope groups with input[name=group]:radio; prefer [type="radio"] when performance matters.
Wrap Up
Conclusion
The :radio selector matches every input type="radio" element — the official demo wraps them in styled spans and reports the match count.
Prefix with input, scope groups with name, and use [type="radio"] when you need native query performance.
Assume all radios share one selection — check name
Style without scoping when multiple forms exist
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about :radio
Radio-type inputs only.
5
Core concepts
●01
:radio
One-of-many
API
=02
[type=]
Equivalent
Rule
name03
Group
Scope it
Tip
☑04
≠ checkbox
Separate
Compare
demo05
Official
Wrap count
Demo
❓ Frequently Asked Questions
:radio selects every input element whose type attribute is radio — mutually exclusive options in a 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 jQuery 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.
The official jQuery form demo wraps $("form input:radio") in styled spans and reports how many were found — typically two radio inputs among checkboxes, text fields, and other controls in the sample form.
Did you know?
Official jQuery input-type demos share the same pattern for checkbox, file, password, radio, and others: wrap or style matched inputs, print For this type jQuery found N., and call event.preventDefault() on form submit so the demo page does not reload.