jQuery Form Events
What You’ll Learn
Form events let JavaScript respond when users interact with inputs, textareas, selects, and other focusable elements. jQuery’s .on() and .off() provide a consistent API. Start with the blur event — the most common pattern for field-level validation.
.on()
Bind handlers
blur
Lose focus
focus
Gain focus
.trigger()
Fire events
focusout
Delegation
14 guides
Full index
Introduction
Every signup form, login page, and search box relies on knowing when a user enters or leaves a field. Form events cover those moments — plus value changes and form submission. jQuery wraps the browser’s native event system so you write one handler that works everywhere.
What Are jQuery Form Events?
Form events are named strings passed to .on() — "blur", "focus", "change", "submit", and others. The handler receives an event object with details about the interaction. Unlike deprecated shortcuts like .blur(fn), .on("blur", fn) is the modern approach that also supports delegation and namespaced unbinding.
Use .on("blur", handler) to validate or clean up a field when the user tabs away or clicks elsewhere. Pair with .on("focus", handler) to show hints when they enter the field.
📝 Syntax
Minimal blur binding workflow:
$("#email").on("blur", function() {
// validate when user leaves the field
});
$("#email").trigger("blur");
$("#signup-form").on("focusout", "input", function() {
// one handler for all inputs — bubbles
}); 👀 blur vs focus vs focusout vs deprecated .blur()
Four related focus APIs — pick the right tool:
Form Event Tutorial Index
Search by event name or browse by category. Each tutorial includes syntax, try-it examples, and FAQs.
Focus & Blur
8 tutorialsReact when form fields and other elements gain or lose keyboard focus.
| Event | Description | Tutorial |
|---|---|---|
focus event | Bind a handler or trigger the focus event when an element gains focus — click in, tab to, or call .trigger('focus'). | Open |
focusin event | Bubbling focus event — bind on parent forms to react when any nested input gains focus, including dynamic fields. | Open |
.focus() | Deprecated shorthand to bind or trigger focus — use .on('focus') and .trigger('focus') in new code (since 3.3). | Open |
.focusin() | Deprecated shorthand to bind or trigger focusin — use .on('focusin') and .trigger('focusin') in new code (since 3.3). | Open |
blur event | Bind a handler or trigger the blur event when an element loses focus — tab away, click elsewhere, or call .trigger('blur'). | Open |
focusout event | Bubbling blur event — bind on parent forms to validate or react when any nested input loses focus, including dynamic fields. | Open |
.focusout() | Deprecated shorthand to bind or trigger focusout — use .on('focusout') and .trigger('focusout') in new code (since 3.3). | Open |
.blur() | Deprecated shorthand to bind or trigger blur — use .on('blur') and .trigger('blur') in new code (since 3.3). | Open |
Value Changes
2 tutorialsRespond when the user commits a new value in inputs, selects, and textareas.
| Event | Description | Tutorial |
|---|---|---|
change event | Bind a handler or trigger the change event when an input, select, or textarea value changes — immediate on select/checkbox, on blur for text inputs. | Open |
.change() | Deprecated shorthand to bind or trigger change — use .on('change') and .trigger('change') in new code (since 3.3). | Open |
Text Selection
2 tutorialsReact when the user highlights text inside inputs and textareas.
| Event | Description | Tutorial |
|---|---|---|
select event | Bind a handler when the user highlights text inside an input or textarea — not the HTML select dropdown. | Open |
.select() | Deprecated shorthand to bind or trigger select — use .on('select') and .trigger('select') in new code (since 3.3). | Open |
Form Submission
2 tutorialsIntercept form submit attempts for validation, AJAX, or conditional send.
| Event | Description | Tutorial |
|---|---|---|
submit event | Bind a handler when the user attempts to submit a form — validate, preventDefault, or send with AJAX before navigation. | Open |
.submit() | Deprecated shorthand to bind or trigger submit — use .on('submit') and .trigger('submit') in new code (since 3.3). | Open |
Conclusion
jQuery form events turn field interactions into JavaScript callbacks. Start with .on("blur", handler) for validation when users leave inputs, use .on("focus", handler) to show hints on entry, and reach for focusout delegation when forms grow dynamically.
❓ Frequently Asked Questions
Start with blur event
Learn .on("blur"), .trigger("blur"), and form validation patterns.
6 people found this page helpful
