.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
Call
What it does
handler
function(event) — runs before default submit
eventData
Extra data available as event.data
No-arg call
Fires 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
Parameter
Description
Step 1
Bind with .submit(handler) (legacy) or .on("submit", handler) (preferred) on a form.
Click #other → submit handlers run
preventDefault keeps the page here
How It Works
Bind. A submit handler is ready on #target.
Click. The button calls no-arg .submit().
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.