.select() is jQuery’s legacy shorthand for binding or triggering the select event — when the user highlights text inside an input or textarea. Binding is deprecated since 3.3; modern code uses .on("select") / .trigger("select"). It is not the HTML <select> dropdown.
Remember
// Legacy (still works; bind form deprecated since 3.3)
$("#target").select(function () {
// user highlighted text inside the field
});
// Modern replacements
$("#target").on("select", handler); // bind
$("#target").trigger("select"); // fire + select all text
// Not for HTML <select> dropdowns → use change
$("#country").on("change", handler);
Highlight text → modern handler message
(legacy bind removed after migration)
How It Works
Find. Search legacy code for .select(.
Rename bind..select(fn) → .on("select", fn).
Rename trigger..select() → .trigger("select").
Test. Highlight and trigger both still work the same.
Example 5 — Select-All Button (Modern Trigger)
Common UX: a button selects all text. Prefer .trigger("select").
jQuery
$("#code").on("select", function () {
$("#out").text("All or part of the code is selected.");
});
$("#select-all").on("click", function () {
$("#code").trigger("select"); // modern; was .select()
});
Click Select all → entire #code selected
Handler updates #out
How It Works
Bind. Modern .on("select") listens for highlights.
Click. The button calls .trigger("select").
Default. The browser selects the whole field.
Legacy. Old code may still say .select() with no args.
Edge Cases & Pitfalls
Check these before keeping or writing .select() calls.
deprecated
Bind form is deprecated since 3.3
Prefer .on("select", handler). The shorthand still works in jQuery 3.x for legacy code.
name
Not the HTML <select> element
Dropdown changes use change. .select() is for text highlights only.
trigger
No-arg .select() selects all text
Same as .trigger("select") — expect the whole field to become selected.
delegation
No event delegation via shorthand
Use .on("select", "input", fn) on a parent for dynamically added fields.
Compatibility
Browser Support
The .select() shorthand has existed since jQuery 1.0 (eventData since 1.4.3). Binding is deprecated since 3.3 but still present in jQuery 3.x. Prefer .on("select") / .trigger("select") for new code.
✓ Deprecated 3.3+
jQuery .select() shorthand
Works wherever jQuery runs for input/textarea. Binding deprecated since 3.3 — migrate to .on('select') / .trigger('select'). Not for HTML select dropdowns.
Legacy OKPrefer .on() / .trigger()
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
.select()Deprecated bind
Bottom line: Safe to read in old codebases. For new work, use the select event API with .on() and .trigger().
Analysis
Performance Notes
Approach
Cost
Best for
.select(fn) / .on("select", fn)
Same cost
Known text fields
No-arg .select() / .trigger("select")
Cheap
Select-all buttons
Heavy work on every select
Expensive
Avoid — keep handlers light
Migration from .select() to .on("select") does not change performance — it is a clearer, supported API.
Remember
Key Takeaways
Role: legacy shorthand for the text-highlight select event.
Modern API:.on("select", fn) and .trigger("select").
Not dropdowns: HTML <select> uses change.
Deprecated: bind form since jQuery 3.3 — migrate when you touch old files.
One line: treat .select() as legacy — use .on("select") / .trigger("select") for text highlights.
Frequently Asked Questions
The .select() method has two roles. With a handler — .select(handler) or .select(eventData, handler) — it binds a function that runs when the user highlights text inside an input or textarea. With no arguments — .select() — it triggers the select event, running bound handlers and typically selecting all text. Binding has been part of jQuery since 1.0 and is deprecated since 3.3. Do not confuse this with HTML <select> dropdowns.
Yes. The binding signatures .select(handler) and .select(eventData, handler) are deprecated since jQuery 3.3. Use .on("select", handler) instead. The no-argument .select() trigger still works, but .trigger("select") is clearer. Legacy code continues to run in jQuery 3.x.
.select(handler) registers a callback and does not fire immediately. .select() with no arguments triggers the select event — the same as .trigger("select") — and usually selects all text in the field. Check whether parentheses contain a function before reading legacy code.
Replace .select(fn) with .on("select", fn). Replace .select(data, fn) with .on("select", data, fn). Replace no-arg .select() with .trigger("select"). Cleanup with .off("select"). Under the hood, .select(handler) already delegates to .on("select").
No. jQuery .select() is shorthand for the select event — text highlighting inside inputs and textareas. HTML <select> dropdowns use the change event when the user picks an option.
No. Direct .select(fn) only binds to elements that already match. For dynamic fields, use .on("select", "input", fn) on a parent. That is one reason to prefer .on() over the shorthand.