jQuery :reset Selector

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

What Is :reset?

:reset (since jQuery 1.0) selects every element of type reset — the control that restores a form to its initial defaults. Official docs state it is equivalent to [type="reset"]. Prefer $("input:reset") over bare $(":reset").

Remember
$("input:reset")              // reset inputs (official style)
$("form input:reset")         // reset inside a form
$("input[type=reset]")        // equivalent attribute form

// Avoid on large pages:
$(":reset")                   // implies *:reset

// Clicking reset restores form defaults (browser behavior)
NeedUse
All reset inputs$("input:reset")
One form only$("#form input:reset")
Native speed$("input[type=\"reset\"]")
Submit buttons$("input:submit")
Generic buttons$(":button")

How to Use :reset

Prefix with input, scope to a form, then style, count, or bind a confirm-before-reset handler.

  1. Write $("input:reset") — avoid bare $(":reset") on large pages.
  2. Scope to a form: $("#signup input:reset").
  3. Style or disable the control with normal jQuery methods.
  4. For custom UX, listen for click and call preventDefault() when the user cancels.
  5. For hot paths, prefer input[type="reset"] so the browser can optimize.
PieceRequired?Role
Selector stringYes:reset filter (best with an input prefix)
Form / contextOptionalLimits the search to one form
Event handlerOptionalConfirm, analytics, or custom clear logic
Return value—jQuery collection of matching reset controls (may be empty)

Pseudocode

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

return matches

// Optional follow-up:
on click(reset):
    if user confirms → allow native form reset
    else → preventDefault()

Cheat Sheet

Keep these facts handy while selecting reset buttons.

TopicDetail
Syntax$("input:reset")
SincejQuery 1.0 · jQuery extension
Equivalent$("[type=\"reset\"]")
MatchesElements with type="reset"
Native clickRestores that form’s default values
vs :submitReset clears; submit sends
vs :buttonDifferent control types
Native CSSUse [type="reset"] for speed

Live Preview

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

Sample markup mirrors the official jQuery form demo, plus a <button type="reset"> for comparison.

Result
$("input:reset")
matched: 1

/* reset inputs only — submit/button 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: input:reset

Style reset inputs and print the match count (jQuery API example).

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

How It Works

  1. Query. $("input:reset") finds reset-type inputs only.
  2. Filter. Text, submit, and checkbox controls are ignored.
  3. Count. .length is how many reset inputs matched.
  4. Report. The message mirrors the official jQuery demo wording.

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

Official docs — both forms select the same type of control.

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

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

How It Works

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

Example 3 — input:reset vs input:submit

Reset and submit are different types — select each independently.

jQuery
$("input:reset").prop("value", "Clear form");
$("input:submit").prop("value", "Send form");

console.log("reset:", $("input:reset").length);
console.log("submit:", $("input:submit").length);
Try It Yourself

How It Works

  1. Reset filter. :reset keeps only reset inputs.
  2. Submit filter. :submit keeps only submit inputs.
  3. No overlap. A single input has one type — it cannot match both.
  4. Labels. Updating value shows which control each selector hit.

Example 4 — Confirm Before Reset

Ask the user before the browser restores the form defaults.

jQuery
$("form input:reset").on("click", function (e) {
  if (!window.confirm("Clear this form?")) {
    e.preventDefault();
    $("#out").text("Reset cancelled.");
  } else {
    $("#out").text("Form will reset to defaults.");
  }
});
Try It Yourself

How It Works

  1. Scope. form input:reset targets the reset control in that form.
  2. Intercept. The click handler runs before the native reset.
  3. Cancel. preventDefault() stops the browser from clearing fields.
  4. Allow. If the user confirms, the default reset behavior continues.

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

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

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

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

How It Works

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

Edge Cases & Pitfalls

Check these before relying on :reset in real forms.

slow

Bare $(":reset") scans everything

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

non-std

Not valid in querySelectorAll

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

button

<button type="reset"> vs input:reset

$("input:reset") skips <button type="reset">. Use [type=reset] when both markup styles must match.

action

Selecting ≠ clearing

:reset finds the control. The browser performs the clear on click unless you preventDefault().

Browser Support

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

✓ jQuery 1.0+ · extension

jQuery :reset Selector

Supported across jQuery 1.x, 2.x, and 3.x wherever your jQuery build runs. Prefer input:reset; use input[type="reset"] 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
:reset Universal

Bottom line: Safe everywhere jQuery runs. Scope with form input:reset; prefer [type="reset"] when performance matters.

Performance Notes

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

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

Key Takeaways

  • Role: select form controls with type="reset".
  • Prefix: use $("input:reset"), not bare $(":reset").
  • Action: the browser clears the form on click — the selector only finds the control.
  • Speed: prefer [type="reset"]; pair with :submit when styling form actions.

One line: $("input:reset") finds reset buttons — scope to a form, confirm before clear when needed, and use [type="reset"] for native speed.

Frequently Asked Questions

:reset selects every element whose type is reset — usually an input that restores a form to its initial defaults. $("input:reset") finds reset inputs 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 demos use input:reset.
Yes. Official docs state that :reset is equivalent to [type="reset"]. For native querySelectorAll performance, prefer input[type="reset"] over the :reset pseudo-class.
:reset matches type=reset. :submit matches submit controls. :button matches button-type controls (and <button> tags in the :button selector). They select different form controls — no overlap for a single input’s type.
The browser restores every control in that form to its initial default values. :reset only selects the reset control itself — it does not perform the reset. Use a click handler if you need custom confirm-before-reset behavior.
No. It is a jQuery extension (not part of the CSS specification), so queries using :reset cannot use the native querySelectorAll boost. Use [type="reset"] when performance matters.

Next: :submit Selector

Learn how to select submit buttons in forms with the :submit selector.

:submit 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