The submit event fires when the user attempts to submit a form — click a submit button, press Enter in certain fields, or call .trigger("submit"). Bind with .on("submit", handler) (jQuery 1.7+). The handler runs before the browser navigates or posts.
Remember
$("#target").on("submit", function (event) {
// runs before the form posts / navigates
event.preventDefault(); // stop the default submit
});
$("#other").on("click", function () {
$("#target").trigger("submit"); // run handlers (+ default unless prevented)
});
// Prefer this over deprecated .submit(handler)
Call event.preventDefault() to stop the browser from posting/navigating.
Trigger with .trigger("submit") from a custom button if needed.
For AJAX, preventDefault, then .serialize() and send with $.post() / $.ajax().
Piece
Required?
Role
<form>
Yes
Only element type that receives submit
handler
For bind
function(event) — runs before default submit
eventData
Optional
Extra data available as event.data
preventDefault
Often
Cancel navigation for validation / AJAX
Pseudocode
Pseudocode
call form.on("submit", handler)
→ store handler on the form
when user clicks submit / Enter causes submit / .trigger("submit"):
fire "submit" on form
call handler(event)
if handler called preventDefault (or returned false):
stop browser post / navigation
else:
browser submits the form (navigate or POST)
to migrate shorthand:
.submit(fn) → .on("submit", fn)
.submit() → .trigger("submit")
Reference
Cheat Sheet
Keep these facts handy while wiring form submit UX.
Topic
Detail
Bind
$("form").on("submit", handler)
Trigger
$("form").trigger("submit")
Cancel default
event.preventDefault() or return false
Unbind
$("form").off("submit" [, handler])
Target
<form> only
vs button click
submit covers Enter-key submits too
Since
.on("submit") 1.7 · .trigger("submit") 1.0
Legacy shorthand
.submit() ⚠ deprecated for binding since 3.3
Name conflicts
Avoid input name/id of submit, length, method
Try it
Live Preview
Submit the demo form (always prevented here so the page stays), or run an action to .trigger("submit").
You can also use the form Submit button below.
Result
Ready — submit the form or pick an action.
Code
jQuery Examples
Short, copy-ready snippets based on the official jQuery API demos. Open Try It Yourself for a live editor.
Example 1 — Basic .on("submit") + preventDefault
Official pattern: run a handler when #target is submitted, then stop navigation.
jQuery
$("#target").on("submit", function (event) {
$("#out").text("Handler for submit called.");
event.preventDefault();
});
Submit the form
#out shows "Handler for submit called."
Page does not navigate
How It Works
Bind..on("submit", fn) registers the callback on the form.
Submit. Button click or Enter fires the event.
Handler. Your code runs before the browser posts.
Cancel.preventDefault() keeps the page in place.
Example 2 — Trigger Submit from a Button
Official pattern: #other calls .trigger("submit") — handlers run (and default submit unless prevented).
jQuery
$("#target").on("submit", function (event) {
$("#out").text("Submit handler ran (user or trigger).");
event.preventDefault();
});
$("#other").on("click", function () {
$("#target").trigger("submit");
});
Click #other → submit handlers run
preventDefault keeps the page here
How It Works
Bind. The submit handler is ready on #target.
Click. The outer button runs .trigger("submit").
Handler. Bound callbacks run as if the form was submitted.
Default. Without preventDefault, the form would also post.
Example 3 — Validate Before Allowing Submit
Official demo idea: only allow submit when the value is "correct".
jQuery
$("#demo").on("submit", function (event) {
if ($("#code").val() === "correct") {
$("#out").text("Validated...");
} else {
$("#out").text("Not valid!");
}
event.preventDefault(); // demo stays on page; omit to allow a real post
});
Serialize..serialize() builds a query string from fields.
Send. Pass that string to $.post() or $.ajax().
UX. Update a status area instead of navigating away.
Edge Cases & Pitfalls
Check these before relying on submit handlers in real UIs.
target
Only on <form>
Bind submit on the form, not the button. Button click alone misses Enter-key submits.
names
Avoid name="submit"
Inputs named submit, length, or method can conflict with form properties and break APIs.
Enter
Enter-key behavior varies
Browsers differ on when Enter submits. Do not rely on a specific rule unless you handle keypress yourself.
shorthand
.submit(handler) is deprecated
Prefer .on("submit", handler). The shorthand bind form is deprecated since jQuery 3.3.
Compatibility
Browser Support
The submit event is a standard DOM form event. Bind with .on("submit") since jQuery 1.7; .trigger("submit") has existed since 1.0. Native submit did not bubble in old IE, but jQuery 1.4+ normalizes delegation so scripts work consistently.
✓ jQuery 1.7+
jQuery submit event
Supported in all browsers jQuery targets for forms. Prefer .on('submit') / .trigger('submit'). Use preventDefault for validation and AJAX.
100%With jQuery loaded
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
submitExcellent
Bottom line: Safe for modern and legacy jQuery projects. Bind on the form and cancel with preventDefault when needed.
Analysis
Performance Notes
Approach
Cost
Best for
Direct .on("submit") on the form
Cheap
Validation, AJAX gates
.serialize() in the handler
Cheap
Building POST bodies
Heavy sync work before allow
Expensive
Avoid — keep checks fast
Submit handlers run once per attempt. Keep validation light so the UI feels instant; do heavy work after you decide to send.
Remember
Key Takeaways
Role: react when a form is about to submit — before navigation.
API:.on("submit", fn) and .trigger("submit").
Cancel:preventDefault() or return false for validation / AJAX.
Target: bind on the <form>, not the submit button alone.
One line: use submit on the form to validate or AJAX — cancel with preventDefault when needed.
Frequently Asked Questions
The submit event fires when the user attempts to submit a form — by clicking a submit button, pressing Enter in certain fields, or calling .trigger("submit"). It can only be attached to form elements. Bind with .on("submit", handler) since jQuery 1.7. The handler runs before the browser navigates or sends the request.
Call event.preventDefault() inside your submit handler, or return false from the handler. Both cancel the default submission so the page does not reload. Use this for client-side validation and AJAX submits.
click fires on the button. submit fires on the form for every submission path — including Enter key submits. Bind submit on the form for validation that covers all paths; bind click only for button-specific behavior.
Browser behavior varies. Enter may submit when there is one text field, when a submit button is present, or under other rules. Do not rely on a specific Enter behavior unless you observe keypress yourself. The submit handler still runs whenever the browser submits.
Call $("#myForm").trigger("submit"). Bound handlers run, and unless you preventDefault, the browser also performs the default submit action. Use this from a custom button outside the form.
Prefer .on("submit", handler) and .trigger("submit"). The .submit() shorthand binding form is deprecated since jQuery 3.3. See the .submit() method tutorial for migration details.