.change() is jQuery’s legacy shorthand for binding or triggering the form change event on input, select, and textarea elements. Binding is deprecated since 3.3; modern code uses .on("change") / .trigger("change").
Syntax
Start with these common calls. Keep them short and readable.
jQuery
// Legacy (still works; bind form deprecated since 3.3)
$("#country").change(function () {
// value changed
});
// Modern replacements
$("#country").on("change", handler); // bind
$("#country").trigger("change"); // fire
// .val() does NOT fire change — trigger after script updates
$("#country").val("US").trigger("change");
Call
What it does
handler
function(event) — runs when the value changes
eventData
Extra data available as event.data
No-arg call
Fires change on each matched element
Target elements
input, select, textarea
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Bind with .change(handler) (legacy) or .on("change", handler) (preferred).
Click #set-pro
.val("pro") alone would not update #out
.val("pro").change() → "Tier is now: pro"
How It Works
Bind. The handler is registered first.
Silent set..val("pro") updates the control without firing change.
Trigger. No-arg .change() runs bound handlers.
Frequently Asked Questions
The .change() method has two roles. With a handler — .change(handler) or .change(eventData, handler) — it binds a function that runs when an input, select, or textarea value changes. With no arguments — .change() — it triggers the change event on each matched element. Binding has been part of jQuery since 1.0 and is deprecated since 3.3.
Yes. The binding signatures .change(handler) and .change(eventData, handler) are deprecated since jQuery 3.3. Use .on("change", handler) instead. The no-argument .change() trigger still works, but .trigger("change") is clearer. Legacy code continues to run in jQuery 3.x.
.change(handler) registers a callback and does not fire immediately. .change() with no arguments triggers the change event — the same as .trigger("change"). Check whether parentheses contain a function before reading legacy code.
Replace .change(fn) with .on("change", fn). Replace .change(data, fn) with .on("change", data, fn). Replace no-arg .change() with .trigger("change"). Cleanup with .off("change"). Under the hood, .change(handler) already delegates to .on("change").
No. Setting a value with .val("new") does not fire change — whether you bound with .change(fn) or .on("change", fn). After programmatic updates, call .change() or .trigger("change"): $("#country").val("US").trigger("change").
No. Direct .change(fn) only binds to elements that already match. For dynamic fields, use .on("change", "select", fn) on a parent. That is one reason to prefer .on() over the shorthand.