jQuery .submit() Method

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

What Is .submit()?

.submit() is jQuery’s legacy shorthand for binding or triggering the submit event on a <form> — when the user attempts to send the form. Binding is deprecated since 3.3; modern code uses .on("submit") / .trigger("submit").

Remember
// Legacy (still works; bind form deprecated since 3.3)
$("#target").submit(function (event) {
  event.preventDefault(); // stop navigation
});

// Modern replacements
$("#target").on("submit", handler);     // bind
$("#target").trigger("submit");         // fire handlers (+ default unless prevented)

// Bind on the <form>, not the button
NeedUse
New code (bind).on("submit", fn)
New code (trigger).trigger("submit")
Legacy bind.submit(fn) ⚠ deprecated 3.3
Legacy trigger.submit() (prefer .trigger)
Stop navigationevent.preventDefault() or return false

How to Use .submit()

Recognize the legacy API in old code, then migrate to .on() / .trigger().

  1. Bind with .submit(handler) (legacy) or .on("submit", handler) (preferred) on a form.
  2. Optionally pass eventData: .submit(data, handler) → .on("submit", data, handler).
  3. Trigger with no-arg .submit() (legacy) or .trigger("submit") (preferred).
  4. Call event.preventDefault() inside the handler to stop a full page post.
  5. For dynamic forms, use delegated .on("submit", "form", fn) — not .submit().
PieceRequired?Role
handlerFor bind formfunction(event) — runs before default submit
eventDataOptional (1.4.3+)Extra data available as event.data
No-arg callFor triggerFires submit on each matched form
<form>YesOnly element type that receives submit

Pseudocode

Pseudocode
// Legacy
call form.submit(handler)
    → bind "submit" on form

when user submits / .submit() with no args:
    fire "submit" on form
    call handler(event)
    if not prevented → browser posts / navigates

// Modern
call form.on("submit", handler)
call form.trigger("submit")

to migrate:
    .submit(fn)       → .on("submit", fn)
    .submit(data, fn) → .on("submit", data, fn)
    .submit()         → .trigger("submit")

Cheat Sheet

Quick map from the shorthand to modern APIs.

TopicDetail
Legacy bind$("form").submit(handler) ⚠ deprecated 3.3
Modern bind$("form").on("submit", handler)
Legacy trigger$("form").submit()
Modern trigger$("form").trigger("submit")
Cancel defaultevent.preventDefault() or return false
Unbind$("form").off("submit" [, handler])
Since / status1.0 · eventData 1.4.3 · bind deprecated 3.3
Target<form> only
DelegationNot via .submit() — use .on("submit", "form", fn)

Live Preview

Submit the demo form (always prevented here), or run an action with legacy .submit() (still available in jQuery 3.x).

You can also use the form Submit button below.

Result
Ready — submit the form or pick an action.

jQuery Examples

Short, copy-ready snippets. Prefer .on("submit") for new projects; these demos show the legacy API you will still meet in older code.

Example 1 — Basic .submit(handler)

Legacy bind: run a handler when #target is submitted, then stop navigation.

jQuery
$("#target").submit(function (event) {
  $("#out").text("Handler for submit called (.submit(fn)).");
  event.preventDefault();
});
Try It Yourself

How It Works

  1. Bind. .submit(fn) registers the callback (deprecated).
  2. Submit. Button click or Enter fires the event.
  3. Cancel. preventDefault() keeps the page in place.
  4. Prefer. New code should use .on("submit", fn).

Example 2 — .submit(eventData, handler)

Pass metadata (since 1.4.3). Modern form: .on("submit", data, fn).

jQuery
$("#signup").submit({ form: "signup" }, function (event) {
  $("#out").text("Submitting " + event.data.form);
  event.preventDefault();
});
Try It Yourself

How It Works

  1. Data. The object becomes event.data.
  2. Submit. Submitting the form fires the handler.
  3. Label. Read event.data.form for shared context.
  4. Migrate. Use .on("submit", data, fn) in new code.

Example 3 — No-Arg .submit() Trigger

No arguments means trigger — same as .trigger("submit").

jQuery
$("#target").submit(function (event) {
  $("#out").text("Submit handler ran (user or .submit()).");
  event.preventDefault();
});

$("#other").on("click", function () {
  $("#target").submit(); // no-arg → trigger
});
Try It Yourself

How It Works

  1. Bind. A submit handler is ready on #target.
  2. Click. The button calls no-arg .submit().
  3. Handler. Bound callbacks run as if the form was submitted.
  4. Prefer. New code should use .trigger("submit").

Example 4 — Migrate to .on("submit")

Side-by-side rename — same behavior, modern API.

jQuery
// Before (deprecated bind)
$("#target").submit(function (event) {
  $("#out").text("legacy .submit(fn)");
  event.preventDefault();
});

// After (preferred)
$("#target").on("submit", function (event) {
  $("#out").text("modern .on(\"submit\", fn)");
  event.preventDefault();
});

// Trigger: .submit() → .trigger("submit")
Try It Yourself

How It Works

  1. Find. Search legacy code for .submit(.
  2. Rename bind. .submit(fn) → .on("submit", fn).
  3. Rename trigger. .submit() → .trigger("submit").
  4. Test. Submit and trigger both still work the same.

Example 5 — Validate with Legacy .submit(fn)

Common legacy pattern: check a field, then preventDefault when invalid.

jQuery
$("#demo").submit(function (event) {
  if ($("#code").val() === "correct") {
    $("#out").text("Validated...");
  } else {
    $("#out").text("Not valid!");
  }
  event.preventDefault(); // demo stays on page
});
Try It Yourself

How It Works

  1. Bind. Legacy .submit(fn) listens on the form.
  2. Check. Read the field value in the handler.
  3. Message. Show Validated or Not valid.
  4. Modern. Same logic with .on("submit", fn).

Edge Cases & Pitfalls

Check these before keeping or writing .submit() calls.

deprecated

Bind form is deprecated since 3.3

Prefer .on("submit", handler). The shorthand still works in jQuery 3.x for legacy code.

default

No-arg .submit() can navigate

Triggering submit runs the default form action unless a handler calls preventDefault().

names

Avoid name="submit"

Inputs named submit, length, or method can conflict with form properties.

delegation

No event delegation via shorthand

Use .on("submit", "form", fn) on a parent for dynamically added forms.

Browser Support

The .submit() shorthand has existed since jQuery 1.0 (eventData since 1.4.3). Binding is deprecated since 3.3 but still present in jQuery 3.x. Prefer .on("submit") / .trigger("submit") for new code.

✓ Deprecated 3.3+

jQuery .submit() shorthand

Works wherever jQuery runs for forms. Binding deprecated since 3.3 — migrate to .on('submit') / .trigger('submit'). Use preventDefault for validation and AJAX.

Legacy OK Prefer .on() / .trigger()
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() Deprecated bind

Bottom line: Safe to read in old codebases. For new work, use the submit event API with .on() and .trigger().

Performance Notes

ApproachCostBest for
.submit(fn) / .on("submit", fn)Same costValidation, AJAX gates
No-arg .submit() / .trigger("submit")CheapCustom submit buttons
Heavy sync work before allowExpensiveAvoid — keep checks fast

Migration from .submit() to .on("submit") does not change performance — it is a clearer, supported API.

Key Takeaways

  • Role: legacy shorthand for the form submit event.
  • Modern API: .on("submit", fn) and .trigger("submit").
  • Cancel: preventDefault() — shorthand does not stop navigation by itself.
  • Deprecated: bind form since jQuery 3.3 — migrate when you touch old files.

One line: treat .submit() as legacy — use .on("submit") / .trigger("submit") on the form.

Frequently Asked Questions

The .submit() method has two roles. With a handler — .submit(handler) or .submit(eventData, handler) — it binds a function that runs when the user attempts to submit a matched form. With no arguments — .submit() — it triggers the submit event on each matched form, running bound handlers and performing the default submit action unless prevented. Binding has been part of jQuery since 1.0 and is deprecated since 3.3.
Yes. The binding signatures .submit(handler) and .submit(eventData, handler) are deprecated since jQuery 3.3. Use .on("submit", handler) instead. The no-argument .submit() trigger still works, but .trigger("submit") is clearer. Legacy code continues to run in jQuery 3.x.
.submit(handler) registers a callback and does not fire immediately. .submit() with no arguments triggers the submit event — the same as .trigger("submit"). Check whether parentheses contain a function before reading legacy code.
Replace .submit(fn) with .on("submit", fn). Replace .submit(data, fn) with .on("submit", data, fn). Replace no-arg .submit() with .trigger("submit"). Cleanup with .off("submit"). Under the hood, .submit(handler) already delegates to .on("submit").
No. Inside your handler, call event.preventDefault() or return false to cancel the default submit. The no-arg .submit() trigger will navigate unless a bound handler prevents it.
No. Direct .submit(fn) only binds to forms that already match. For dynamic forms, use .on("submit", "form", fn) on a parent. That is one reason to prefer .on() over the shorthand.

Next: focus event

Learn how to bind handlers when a form field gains focus.

focus 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