jQuery .submit() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Form Events

Definition

.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").

Syntax

Start with these common calls. Keep them short and readable.

jQuery
// 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
CallWhat it does
handlerfunction(event) — runs before default submit
eventDataExtra data available as event.data
No-arg callFires submit on each matched form
<form>Only element type that receives submit

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Bind with .submit(handler) (legacy) or .on("submit", handler) (preferred) on a form.
Step 2Optionally pass eventData: .submit(data, handler) → .on("submit", data, handler).
Step 3Trigger with no-arg .submit() (legacy) or .trigger("submit") (preferred).

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

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.

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.

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.

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: Browser Events

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

Browser Events tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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