jQuery :submit Selector

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

What Is :submit?

:submit (since jQuery 1.0) selects elements of type submit — usually <input type="submit"> and <button type="submit">. Official docs: always set a type on <button> so browsers agree on whether it submits.

Remember
$(":submit")                         // submit controls
$("input:submit")                    // input submit only
$("form :submit")                    // scoped to a form
$("td :submit")                      // official demo style

// Native / faster (official tip):
$('input[type="submit"], button[type="submit"]')

// Always set type on <button> for consistent matching
NeedUse
All submit controls$(":submit") or scoped $("form :submit")
Input submit only$("input:submit")
Native speed$('input[type="submit"], button[type="submit"]')
Reset buttons$("input:reset")
Generic buttons$(":button")

How to Use :submit

Scope to a form or cell, count or style matches, and always declare type on buttons.

  1. Write $("form :submit") or $("input:submit") instead of a vague bare scan when possible.
  2. Give every <button> an explicit type="submit" or type="button".
  3. Style, disable, or bind clicks with normal jQuery methods.
  4. Prevent accidental navigations in demos with $("form").on("submit", …) and preventDefault().
  5. For hot paths, use the official attribute selector list instead of :submit.
PieceRequired?Role
Selector stringYes:submit filter (best with a context)
Form / cell contextRecommendedLimits matches to one region
type on <button>Strongly recommendedCross-browser submit behavior
Return value—jQuery collection of matching submit controls

Pseudocode

Pseudocode
matches = []
for each element in search context:
    if element is a submit control
       (input type=submit, or button that submits):
        matches.add(element)

return matches

// Safer markup:
button elements always have an explicit type

Cheat Sheet

Keep these facts handy while selecting submit controls.

TopicDetail
Syntax$(":submit") / $("input:submit")
SincejQuery 1.0 · jQuery extension
MatchesSubmit input / button controls
vs :resetSend form vs clear form
vs :buttonSubmit action vs generic button
Markup tipAlways set type on <button>
Native CSSinput[type=submit], button[type=submit], …
Official demo$("td :submit") then style parent cells

Live Preview

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

Sample includes input submit, button submit, reset, and plain buttons — similar to the official form demos.

Result
$(":submit")
matched: 2

/* input submit + button type=submit */

jQuery Examples

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

Example 1 — Count Submit Controls

Official idea: find :submit matches and report the length.

jQuery
var submitEl = $("form :submit");
$("#result").text("jQuery matched " + submitEl.length + " elements.");
$("form").on("submit", function (e) { e.preventDefault(); });
Try It Yourself

How It Works

  1. Scope. form :submit searches submit controls inside the form.
  2. Match. Both input and button submit controls are included.
  3. Report. .length is how many matched.
  4. Safety. preventDefault() stops a real navigation in the demo.

Example 2 — input:submit vs button[type=submit]

See that :submit can match more than just <input>.

jQuery
console.log("input:submit →", $("input:submit").length);
console.log("button[type=submit] →", $("button[type=submit]").length);
console.log(":submit →", $(":submit").length);
Try It Yourself

How It Works

  1. Input only. input:submit ignores <button> elements.
  2. Button only. The attribute selector finds submit buttons.
  3. Union. :submit covers both kinds of submit control.
  4. Choose. Narrow with a tag/attribute when you need one markup style.

Example 3 — :submit vs :reset

Submit sends the form; reset clears it — different selectors.

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

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

How It Works

  1. Submit filter. :submit keeps submit controls only.
  2. Reset filter. :reset keeps reset inputs only.
  3. No overlap. One control has one type.
  4. Labels. Updating value shows which selector hit which control.

Example 4 — Always Set type on <button>

Official docs — explicit type keeps submit matching consistent.

jQuery
var lines = [
  "typed submit: " + $("button[type=submit]").length,
  "typed button: " + $("button[type=button]").length,
  ":submit total: " + $(":submit").length
];
$("#out").text(lines.join("\\n"));
Try It Yourself

How It Works

  1. Declare. type="submit" and type="button" remove browser guesswork.
  2. Count typed. Attribute selectors confirm each role.
  3. Total. :submit still includes matching inputs and buttons.
  4. Habit. Never leave a bare <button> in forms you need to select reliably.

Example 5 — Native Performance Pattern

Official tip — use attribute selectors so modern browsers can optimize.

jQuery
var $native = $('input[type="submit"], button[type="submit"]');
$("#out").text(
  "native match: " + $native.length + "\\n" +
  ":submit match: " + $(":submit").length
);
Try It Yourself

How It Works

  1. Standard CSS. Attribute selectors work in querySelectorAll.
  2. Same set. With explicit types, counts match :submit.
  3. Docs tip. Add button:not([type]) only if you must support typeless buttons.
  4. When. Prefer this form on large pages or frequent re-queries.

Edge Cases & Pitfalls

Check these before relying on :submit in real forms.

type

Bare <button> is inconsistent

Official docs: some browsers imply type="submit", others do not. Always set type explicitly.

non-std

Not valid in querySelectorAll(":submit")

Use input[type="submit"], button[type="submit"] for native CSS queries.

overlap

:button can also match

A <button type="submit"> matches both :button and :submit. Prefer the selector that matches your intent.

scope

Many forms on one page

Bare $(":submit") hits every form. Scope with $("#signup :submit").

Browser Support

The :submit pseudo-class is a jQuery extension and has worked since jQuery 1.0. Prefer attribute selectors for native querySelectorAll performance, and always set type on <button> elements.

✓ jQuery 1.0+ · extension

jQuery :submit Selector

Supported across jQuery 1.x, 2.x, and 3.x wherever your jQuery build runs. Prefer :submit for convenience; use attribute selectors 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
:submit Universal

Bottom line: Safe everywhere jQuery runs. Scope to a form, set button types explicitly, and prefer attribute selectors when performance matters.

Performance Notes

ApproachCostBest for
$('input[type="submit"], button[type="submit"]')FastestModern browsers / hot paths
$("form :submit")CheapTypical forms
$("input:submit")CheapInput-only markup
$(":submit")SlowerAvoid on large pages

Official docs: because :submit is not CSS, it cannot use the querySelectorAll boost. Prefer the documented attribute selector list when you re-query often.

Key Takeaways

  • Role: select submit input / button controls.
  • Markup: always set type on <button> elements.
  • Contrast: use :reset to clear, :submit to send.
  • Speed: prefer attribute selectors; next topic is :root.

One line: $(":submit") finds form submit controls — set button types explicitly, scope to a form, and use attribute selectors when you need native speed.

Frequently Asked Questions

:submit selects every form control of type submit — typically input[type="submit"] and button[type="submit"]. Official docs note it applies to button or input elements. Available since jQuery 1.0.
:submit matches controls that submit the form. :button matches button elements and input[type="button"]. A <button type="submit"> can match both :button and :submit; input[type="submit"] matches :submit, not :button.
Yes. Official docs warn that some browsers treat <button> as type="submit" implicitly while others (historically IE) do not. Always set type="submit" or type="button" for consistent markup and matching.
Official docs recommend input[type="submit"], button[type="submit"], button:not([type]) for querySelectorAll performance instead of the jQuery :submit extension.
:submit matches controls that send the form. :reset matches type=reset controls that restore default field values. They never overlap for a single control’s type.
No. It is a jQuery extension, so it cannot use the native querySelectorAll boost. Prefer the attribute selectors listed in the docs when performance matters.

Next: :root Selector

Learn how to select the document root element with the :root selector.

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