The :reset selector matches every <input type="reset"> element — the control that restores a form to its default values. Available since jQuery 1.0; equivalent to [type=reset]; always prefer input:reset over bare :reset.
01
Syntax
input:reset
02
type=reset
Clear form
03
Official
Style + count
04
vs :button
Different type
05
vs :submit
Not submit
06
Native CSS
Faster query
Fundamentals
Introduction
Registration forms, settings panels, and search filters often include a reset button so users can undo edits and return to the starting state. jQuery’s :reset pseudo-class selects every input whose type attribute is reset.
Official jQuery documentation notes that :reset is equivalent to [type=reset], and recommends prefixing with input — bare $(":reset") implies $("*:reset"). When clicked, a reset control triggers the browser’s native form-reset behavior unless you intercept it.
Concept
Understanding the :reset Selector
Think of :reset as a shortcut for reset-type inputs only:
input:reset → every reset button in scope.
$("#signup input:reset") → reset controls in one form.
input:button → different type — plain buttons, not reset.
Clicking reset restores fields to their initial HTML default values.
💡
Beginner Tip
Reset buttons are less common today than “Clear” links wired in JavaScript, but :reset still matches the native HTML control when it exists.
No arguments — keeps elements whose type is reset.
Return value
A jQuery object containing every matching reset input (zero or more).
Official jQuery API example
jQuery
var input = $( "input:reset" ).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:reset
input[type="reset"]
<input type="reset">
Matches
Matches
<input type="button">
No match
No match
<input type="submit">
No match
No match
<button type="reset">
No match
No match
Native querySelectorAll
Not supported
Supported
Compare
📋 :reset vs :button and :submit
Form action buttons — each type has its own jQuery pseudo-class.
:reset
input:reset
Restore defaults
:button
input:button
Plain buttons
:submit
input:submit
Send form data
[type=reset]
input[type="reset"]
Native CSS — faster
Hands-On
Examples Gallery
Example 1 follows the official jQuery input:reset demo. Examples 2–5 cover attribute equivalence, contrast with other button types, scoped form queries, and the native performance pattern.
📚 Official jQuery Demo
Style every reset input and report how many matched.
Example 1 — Official Demo: input:reset
Official jQuery demo — yellow background, red border, and match count in red text.
jQuery
var input = $( "input:reset" ).css({
background: "yellow",
border: "3px red solid"
});
$( "div" )
.text( "For this type jQuery found " + input.length + "." )
.css( "color", "red" );
$( "form" ).on( "submit", function( event ) {
event.preventDefault();
} );
#searchForm reset → .clear-btn class
#loginForm reset → unchanged
How It Works
Prefix the form id before input:reset to limit the matched set to one form context.
Example 5 — Native Performance: input[type="reset"]
Official docs — use attribute selector in modern browsers for querySelectorAll speed.
jQuery
$( "input[type='reset']" ).on( "click", function() {
console.log( "Form will reset to defaults" );
});
// Pure DOM (no jQuery pseudo-class):
document.querySelectorAll( "input[type='reset']" );
Click reset → console logs message
Browser then restores form fields to initial values
How It Works
Because :reset is not standard CSS, attribute matching lets the browser optimize the query.
Applications
🚀 Common Use Cases
Search filters — style or count input:reset in filter forms.
Registration wizards — highlight the clear-all control at the bottom.
Settings panels — confirm before native reset with a click handler.
Multi-form pages — scope with $("#formId input:reset").
Accessibility — pair reset inputs with descriptive value or aria-label text.
Performance — prefer input[type="reset"] in hot paths.
🧠 How jQuery Evaluates :reset
1
Parse selector
Combine input with :reset — optionally scope to a form id.
Query
2
Find candidates
Collect input elements in scope (or all elements if bare :reset).
Scan
3
Filter by type
Keep inputs where type attribute equals reset.
Match
4
✓
Return collection
Chain .css(), .on("click"), or styling methods.
Important
📝 Notes
Available since jQuery 1.0 — equivalent to [type=reset].
jQuery extension only — not valid in native querySelectorAll(":reset").
Always use input:reset — bare :reset implies universal scan.
Matches input[type="reset"] — not button[type="reset"] (use element + attribute selectors for that).
Does not match submit, button, text, or checkbox inputs.
Clicking reset restores the form — use event.preventDefault() if you need custom clear logic instead.
Compatibility
Browser Support
The :reset pseudo-class is a jQuery extension and works in jQuery 1.0+. The equivalent input[type="reset"] attribute selector is standard CSS and runs in native querySelectorAll in all modern browsers.
✓ jQuery 1.0+ · extension
jQuery :reset Selector
Use input:reset in jQuery; use input[type="reset"] 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
:resetUniversal
Bottom line: Scope with form input:reset; prefer [type="reset"] when performance matters.
Wrap Up
Conclusion
The :reset selector matches every input type="reset" element — the official demo styles them and reports the match count.
Prefix with input, scope to your form, and use [type="reset"] when you need native query performance.
Rely on reset for file inputs — browser behavior varies
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about :reset
Reset-type inputs only.
5
Core concepts
↺01
:reset
Clear form
API
=02
[type=]
Equivalent
Rule
form03
Scope
One form
Tip
btn04
≠ :button
Separate
Compare
demo05
Official
Style count
Demo
❓ Frequently Asked Questions
:reset selects every input element whose type attribute is reset — the control that restores a form to its initial default values. $("input:reset") finds all reset buttons in the search context. Available since jQuery 1.0.
Prefer $("input:reset"). Bare $(':reset') implies the universal selector and scans as $('*:reset'), which is slower on large pages. Official jQuery docs recommend prefixing with input or scoping to a form.
Yes. Official jQuery docs state that :reset is equivalent to $('[type="reset"]'). For native querySelectorAll performance in modern browsers, prefer input[type="reset"] over the :reset pseudo-class.
:reset matches input[type="reset"] only. :button matches button tags and input[type="button"]. :submit matches input[type="submit"] and button[type="submit"]. Each form pseudo-class maps to a different control type.
The browser restores every form control in that form to its initial default value — text fields clear to defaults, checkboxes uncheck, selects revert, and so on. jQuery can style reset buttons with :reset before or after that native behavior.
The official jQuery form demo styles $("input:reset") and reports how many were found — typically one reset input among text fields, checkboxes, buttons, and other controls in the sample form.
Did you know?
When a user clicks input[type="reset"], the browser fires a reset event on the form and restores every control to its initial default value. You can listen with $("#myForm").on("reset", fn) to log or confirm the action — or call event.preventDefault() on the reset button click to block native clearing.