jQuery Submit Event

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Form events

What You’ll Learn

The submit event fires when the user attempts to send a <form> — click a submit button, press Enter, or call .trigger("submit"). This tutorial covers .on("submit"), eventData, event.preventDefault(), validation before send, AJAX patterns, and the official jQuery API demos.

01

.on()

Bind handler

02

prevent

Default

03

.trigger()

Fire submit

04

<form>

Only forms

05

Validate

Before send

06

Since 1.7

Modern API

Introduction

Login forms, contact forms, and checkout pages all need one critical hook: code that runs right before the browser sends data to the server. The submit event is that hook — it fires when the user tries to submit the form, giving you a chance to validate, show errors, or send data with AJAX instead of a full page reload.

The official jQuery API distinguishes the submit event (bound with .on("submit") since 1.7) from the deprecated .submit() method in older code. To programmatically run submit handlers, use .trigger("submit") since jQuery 1.0.

Understanding the submit Event

The submit event is sent to a <form> element when the user is attempting to submit it. It can only be attached to forms — not individual inputs, buttons, or divs.

Forms submit when the user clicks an explicit <button type="submit">, <input type="submit">, or <input type="image">, or when Enter is pressed under certain browser conditions. Your handler runs before the actual submission — so you can cancel it with event.preventDefault() or return false.

💡
Beginner Tip

Always call event.preventDefault() when you handle submit with AJAX. Without it, the browser still performs the default action — navigating to the form’s action URL — even after your $.ajax() call starts.

📝 Syntax

The modern jQuery API for the submit event has two main forms — binding a handler and triggering the event:

1. Bind a handler — .on("submit" [, eventData ], handler) (since 1.7)

jQuery
.on( "submit" [, eventData ], handler )
  • eventData — optional object passed to the handler as event.data.
  • handler — function called each time submit fires: function( event ) { ... }.

2. Event delegation — .on("submit", selector, handler)

jQuery
$( "#app" ).on( "submit", "form", function( event ) {
  // runs when any form inside #app is submitted — including future ones
} );

jQuery normalized submit delegation across browsers since 1.4 (native submit did not bubble in IE). You can bind on a parent container for multiple forms, though binding directly on the <form> is most common.

3. Trigger the event — .trigger("submit") (since 1.0)

jQuery
.trigger( "submit" )
  • Runs bound submit handlers on the matched element(s).
  • Also fires the browser default submit action unless you call preventDefault() or return false.

4. Unbind — .off("submit" [, selector] [, handler])

jQuery
$( "#target" ).off( "submit" );              // remove all submit handlers
$( "#app" ).off( "submit", "form", fn );  // remove delegated handler

Official jQuery API examples

jQuery
$( "#target" ).on( "submit", function( event ) {
  alert( "Handler for `submit` called." );
  event.preventDefault();
} );

$( "#other" ).on( "click", function() {
  $( "#target" ).trigger( "submit" );
} );

Return value

  • .on() and .trigger() return the original jQuery object for chaining.
  • Returning false from the handler cancels submission — same as preventDefault() + stopPropagation().

⚡ Quick Reference

GoalCode
Bind submit handler$("#target").on("submit", fn)
Pass data to handler$("#login").on("submit", { id: 1 }, fn)
Prevent default submitevent.preventDefault() or return false
Delegated submit on forms$("#app").on("submit", "form", fn)
Trigger submit programmatically$("#target").trigger("submit")
AJAX serialize and send$.ajax({ url: $(this).attr("action"), data: $(this).serialize() })
Remove submit handlers$("#target").off("submit")

📋 submit vs click vs change vs deprecated .submit()

Four related form concepts — know which fires on the form, the button, or individual fields.

submit event
form send

Form is being submitted — validate, preventDefault, or AJAX replace

click event
button

Mouse press on submit button only — misses Enter-key submits

change event
value diff

Single field value changed — not the same as submitting the whole form

.submit() method
deprecated

Old binding shorthand — use .on("submit") and .trigger("submit") instead

Examples Gallery

Examples 1–2 follow the official jQuery API documentation. Examples 3–5 extend the official validation demo, flag-variable pattern, and AJAX submit. Use the Try-it links to run each snippet in the browser.

📚 Binding & Triggering

Official jQuery demos for submit handlers and programmatic triggers.

Example 1 — Official Demo: Bind Handler on #target

Alert when the form is submitted — cancel the default action with event.preventDefault().

jQuery
$( "#target" ).on( "submit", function( event ) {
  alert( "Handler for `submit` called." );
  event.preventDefault();
} );
Try It Yourself

How It Works

.on("submit", fn) on the form runs before the browser posts data. event.preventDefault() stops navigation — essential for validation and AJAX.

Example 2 — Official Demo: #other Triggers Submit on #target

One button outside the form programmatically fires the submit handler.

jQuery
$( "#target" ).on( "submit", function( event ) {
  alert( "Handler for `submit` called." );
  event.preventDefault();
} );

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

How It Works

.trigger("submit") synthetically fires the event. Handlers run and, unless prevented, the browser performs the default submit — navigating to action.

📈 Validation & AJAX

Official extended demos for validation, conditional submit, and AJAX patterns.

Example 3 — Official Demo: Type “correct” to Validate

Block submission unless the first input equals correct — show feedback with preventDefault().

jQuery
$( "form" ).on( "submit", function( event ) {
  if ( $( "input" ).first().val() === "correct" ) {
    $( "span" ).text( "Validated..." ).show();
    return;
  }
  $( "span" ).text( "Not valid!" ).show().fadeOut( 1000 );
  event.preventDefault();
} );
Try It Yourself

How It Works

When validation passes, the handler returns without preventDefault() — the form submits normally. When it fails, preventDefault() cancels the submission and shows an error message.

Example 4 — Official Demo: Conditional Submit with Flag Variable

Return a boolean from the handler — return false cancels submit the same as preventDefault().

jQuery
var allowSubmit = false;

$( "#gate" ).on( "submit", function() {
  return allowSubmit;
} );

$( "#enable" ).on( "click", function() {
  allowSubmit = true;
  $( "#status" ).text( "Submit enabled — try the form again." );
} );
Try It Yourself

How It Works

Returning false from a jQuery event handler is equivalent to calling both preventDefault() and stopPropagation(). Returning nothing or a truthy value allows the default submit to continue.

Example 5 — AJAX Submit with serialize()

Prevent default navigation and post form data with $.ajax() — common SPA pattern.

jQuery
$( "#contact" ).on( "submit", function( event ) {
  event.preventDefault();
  var $form = $( this );
  $.ajax( {
    url: $form.attr( "action" ),
    method: $form.attr( "method" ) || "POST",
    data: $form.serialize(),
    success: function( response ) {
      $( "#result" ).text( "Sent! Server replied: " + response );
    }
  } );
} );
Try It Yourself

How It Works

.serialize() converts form fields to a query string. preventDefault() is mandatory — without it, the browser navigates away while AJAX is in flight.

🚀 Common Use Cases

  • Client-side validation — block invalid forms with event.preventDefault() before data reaches the server.
  • AJAX login and contact formspreventDefault + $.ajax + .serialize() for no-reload submits.
  • Multi-step wizards — intercept submit on intermediate steps, validate, then advance without posting.
  • Confirm dialogsif (!confirm("Send?")) event.preventDefault() before destructive actions.
  • Analytics tracking — log form submission attempts in the handler before allowing default submit.
  • Custom submit buttons$("#myForm").trigger("submit") from a styled div outside the form.

🚀 How the submit Event Flows

1

User submits

Clicks submit button, presses Enter, or code calls .trigger("submit").

attempt
2

submit event fires

Handler runs on the <form> before the browser sends the request.

submit
3

Handler decides

Validate, AJAX, or preventDefault() to cancel. return false also cancels.

prevent?
4

Default or blocked

If not prevented, browser posts to action URL. If prevented, page stays — your AJAX or error UI runs instead.

📝 Notes

  • Bind with .on("submit", handler) since jQuery 1.7 — not the deprecated .submit(handler) method.
  • Trigger with .trigger("submit") since jQuery 1.0.
  • Limited to <form> elements — not individual inputs or buttons.
  • Handler runs before navigation — use event.preventDefault() to cancel.
  • return false from handler = preventDefault() + stopPropagation().
  • Avoid naming inputs submit, length, or method — conflicts with form properties (DOMLint).
  • jQuery normalized submit delegation since 1.4 for cross-browser consistency.
  • Use .off("submit") to remove handlers — avoid deprecated .unbind("submit").

Browser Support

The submit event is a standard DOM form event supported in every browser jQuery targets. jQuery’s .on("submit") (since 1.7) and .trigger("submit") (since 1.0) normalize cross-browser behavior — including submit delegation fixed in jQuery 1.4.

jQuery 1.7+

jQuery submit event

Supported in jQuery 1.x, 2.x, and 3.x across all modern browsers and IE with supported jQuery versions. Native equivalent: form.addEventListener('submit', fn) — jQuery adds collection binding, eventData, delegation, and .trigger() in one chainable API.

100% With jQuery loaded
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 in any jQuery project. Prefer .on('submit') over deprecated .submit() for binding. Always preventDefault for AJAX submits.

Conclusion

The jQuery submit event is the standard hook for form validation and AJAX submission. Bind handlers with .on("submit", fn), pass optional eventData, and fire handlers programmatically with .trigger("submit"). Cancel unwanted submissions with event.preventDefault() or return false.

Remember: submit fires on the <form>, not individual fields. Use change or blur for per-field validation, then a final submit handler for whole-form checks. For dynamic multi-form pages, delegate with $("#app").on("submit", "form", fn).

💡 Best Practices

✅ Do

  • Bind with .on("submit", handler) on the form element
  • Call event.preventDefault() for AJAX and failed validation
  • Use .serialize() or FormData to collect field values
  • Validate on submit for whole-form rules; use blur for field-level hints
  • Delegate on #app when multiple dynamic forms share one handler

❌ Don’t

  • Use deprecated .submit(handler) for new code — use .on("submit")
  • Bind submit on individual inputs — it only works on <form>
  • Forget preventDefault in AJAX handlers — page will still navigate
  • Confuse submit with click on the button — submit covers Enter key too
  • Name form fields submit or method — breaks form properties

Key Takeaways

Knowledge Unlocked

Six things to remember about the submit event

Validate, prevent, send.

6
Core concepts
stop 02

preventDefault

Cancel

Block
03

.trigger()

Fire

Programmatic
form 04

<form>

Only forms

Scope
ajax 05

AJAX

No reload

Pattern
06

Before send

Timing

Hook

❓ 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 handlers with .on('submit', handler) since jQuery 1.7. The handler runs before the browser navigates away or sends the request.
Call event.preventDefault() inside your submit handler, or return false from the handler. Both cancel the default form submission so the page does not reload. This is essential for client-side validation and AJAX submits: if validation fails, preventDefault stops the bad data from being sent.
click fires when the user presses and releases the mouse on the button. submit fires on the form when a submission is attempted — including Enter key presses that the browser treats as submit. Bind submit on the form for validation that covers every submission path; bind click only when you need button-specific behavior.
Browser behavior varies. Enter may submit when the form has one text field, when a submit button is present, or under other rules depending on the browser. Do not rely on a specific Enter-key behavior unless you observe keypress yourself. The submit handler still runs whenever the browser decides to submit.
Call $('#myForm').trigger('submit') since jQuery 1.0. Bound submit handlers run, and unless you preventDefault, the browser also performs the default submit action — navigating or posting the form. Use this to submit from a custom button outside the form or to re-run validation logic.
Native submit did not bubble in Internet Explorer, but jQuery normalized delegation since 1.4 so .on('submit', handler) on forms works consistently across browsers. You can also delegate from a parent container, though binding directly on the form is the most common pattern.
Did you know?

Returning false from a jQuery submit handler cancels the submission — jQuery treats it like calling event.preventDefault() and event.stopPropagation() together. That is why the official API demo can use return this.some_flag_variable to conditionally allow or block submit. Prefer explicit event.preventDefault() in new code for clarity.

Next: .submit() Method

Legacy shorthand for binding and triggering form submit — deprecated since 3.3.

.submit() method 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.

6 people found this page helpful