The .select() method is jQuery’s legacy shorthand for binding and triggering the select event when users highlight text in inputs and textareas. This tutorial covers .select(handler) since 1.0, .select(eventData, handler) since 1.4.3, no-argument .select() as a trigger (select-all), migration to .on("select") and .trigger("select"), and why the binding form is deprecated since jQuery 3.3. Not the HTML <select> dropdown — see the jQuery select event tutorial for the modern API.
01
.select(fn)
Bind handler
02
eventData
Since 1.4.3
03
.select()
Trigger event
04
.on()
Modern bind
05
.trigger()
Modern fire
06
Deprecated
Since 3.3
Fundamentals
Introduction
Before jQuery 1.7 unified events with .on() and .off(), every common event had a matching shorthand — .select(), .change(), .blur(), and more. The .select() method let you react when a user highlights text in an input or textarea in one short call: $("#target").select(function(){ ... }). It remains in jQuery 3.x for backward compatibility but is marked deprecated. Do not confuse it with HTML <select> dropdown elements.
Understanding .select() matters when reading older text-editor, copy-button, and formatting-toolbar tutorials in legacy codebases. The method does two distinct jobs: with a function argument it binds; with no arguments it triggers and typically selects all text. Modern jQuery splits those roles explicitly — .on("select", handler) for binding and .trigger("select") for firing.
⚠️
Not the <select> dropdown
jQuery .select() is shorthand for the text selection event — highlighting characters in inputs and textareas. HTML dropdown menus use .change() when the user picks a new option. The similar names confuse beginners.
Concept
Understanding the .select() Method
The official jQuery API describes .select() as a way to bind an event handler to the select event, or trigger that event on an element. When you pass a handler, jQuery registers it on each matched text input or textarea and calls it when the user highlights characters — the same select event that .on("select") handles today. It does not apply to HTML <select> dropdowns.
When you call .select() with no arguments, jQuery synthetically fires the select event on each matched element. Bound handlers run and the browser default action usually selects all text in the field — useful for “Select all” buttons. This trigger behavior is equivalent to .trigger("select").
⚠️
Deprecated since jQuery 3.3
Do not use .select(handler) or .select(eventData, handler) in new code. Replace them with .on("select", handler) or .on("select", eventData, handler). Replace no-argument .select() with .trigger("select"). For reading selected text, delegation, and the full modern select event guide, read the jQuery select event tutorial.
Foundation
📝 Syntax
The .select() method has three signatures from the official jQuery API. The binding forms are deprecated; the trigger form remains valid but .trigger("select") is preferred:
📋 .select() vs .on("select") vs .trigger("select") vs .off("select")
Four related APIs — know which one binds, which one fires, and which one removes handlers.
.select()
deprecated
Legacy bind (.select(fn)) or trigger (.select()) — use modern APIs for new code
.on("select")
bind
Modern binding since 1.7 — supports eventData and delegation on dynamic forms
.trigger("select")
fire
Programmatically run handlers — clearer than no-arg .select()
.off("select")
remove
Unbind handlers — pair with .on("select") when cleaning up or in SPAs
Hands-On
Examples Gallery
Five examples cover binding, eventData, triggering, migration from .select() to .on("select"), and method chaining. Use the Try-it links to run each snippet in the browser. Remember: binding with .select(handler) is deprecated — these demos show legacy syntax you will encounter in older code.
📚 Binding & Triggering
Legacy .select() signatures for binding handlers and firing events programmatically.
Example 1 — Bind Handler with .select(handler)
The canonical legacy pattern — alert or show a toolbar when the user highlights text in an input field.
User highlights text in #target
→ handler runs, #out text updates
Deprecated — prefer .on("select", fn) for new code
How It Works
.select(fn) registers the function on the input. jQuery internally routes this to .on("select", fn). The handler runs each time the user highlights text — click-drag, double-click a word, or programmatic trigger.
Example 2 — Pass eventData with .select(eventData, handler)
Since jQuery 1.4.3, pass a helper hint object before the handler — it arrives as event.data.
Highlight text in #bio → "Toolbar: basic | N chars highlighted"
Change selection → count updates each time select fires
eventData.toolbar available as event.data in handler
How It Works
jQuery stores the { toolbar: "basic" } object and injects it into event.data when the user highlights text in #bio. Modern equivalent: .on("select", { toolbar: "basic" }, fn).
Example 3 — Trigger Select with No-Argument .select()
Calling .select() without a handler fires the select event programmatically — run handlers and select all text in the field.
Highlight text in #target → count increments
Click #fire → $("#target").select() → same handler runs
No-arg .select() is trigger shorthand — selects all text; prefer .trigger("select")
How It Works
The first .select(function(){ ... }) binds a handler on #target. The button calls $("#target").select() with no arguments — that synthetically fires select and highlights all text. Replace with $("#target").trigger("select") for clarity.
📈 Migration & Chaining
Compare legacy and modern APIs, and chain after .select(handler).
Example 4 — Migration: .select(fn) vs .on("select", fn)
Both bind the same select event — .on() is the recommended API for new code.
jQuery
$( "#legacy" ).select( function() {
$( "#out" ).text( "Legacy: .select(function(){ ... }) — deprecated since jQuery 3.3." );
} );
$( "#modern" ).on( "select", function() {
$( "#out" ).text( "Modern: .on('select', function(){ ... }) — use this for new code." );
} );
Highlight text in #legacy → legacy deprecation message
Highlight text in #modern → modern .on("select") message
Behavior is identical — only the API name differs
How It Works
Under the hood, .select(fn) calls .on("select", fn). Migration is a straight rename with no behavior change for simple bindings. The advantage of .on() is delegation — $("#editor").on("select", "textarea", fn) — which .select() cannot do.
Example 5 — Chaining After .select(handler)
.select(handler) returns the jQuery object — chain notice and character-count handlers on the same textarea.
jQuery
$( "#bio" )
.select( function() {
$( "#notice" ).text( "Text selected — first handler." ).show();
} )
.select( function() {
var len = this.selectionEnd - this.selectionStart;
$( "#count" ).text( len + " chars" );
} );
User highlights text in #bio
First handler updates #notice
Second handler updates #count with selection length
Both handlers run in bind order on each text selection
How It Works
Multiple .select(fn) calls on the same element stack handlers — all run when the user highlights text. Because each call returns the jQuery object, you can chain them fluently. The same chaining pattern works with .on("select", fn).
Applications
🚀 Common Use Cases
Reading legacy code — recognize $("#target").select(fn) as equivalent to .on("select", fn) in older editor scripts.
Text selection toolbar — legacy tutorials bind .select() to show formatting buttons when the user highlights text.
Select-all buttons — $("#target").select() on button click — replace with .trigger("select").
Selection length display — chained .select(fn) calls show notices and character counts on highlight.
Maintaining WordPress themes — many admin and front-end scripts still use .select() — know how to migrate safely.
🧠 How .select() Routes Through jQuery
1
You call .select()
With a function argument, jQuery treats it as a bind request. With no arguments, it treats it as a trigger request.
dispatch
2
Bind path
.select(handler) delegates internally to .on("select", handler) — the handler is stored in jQuery’s event system.
.on("select")
3
Trigger path
No-arg .select() delegates to .trigger("select") — bound handlers run when select enters.
.trigger("select")
4
✎
jQuery object returned
Both paths return the original collection for chaining — .select(fn).addClass("watched") works the same as .on("select", fn).addClass("watched").
Important
📝 Notes
Deprecated since jQuery 3.3 — do not use .select(handler) or .select(eventData, handler) in new code. Use .on("select") instead.
Bind with .select(handler) since jQuery 1.0; eventData form since 1.4.3.
No-argument .select() triggers the event since jQuery 1.0 — prefer .trigger("select").
.select() does not support event delegation — use .on("select", selector, fn) for dynamic textareas in editors.
Applies to text <input> and <textarea> only — not HTML <select> dropdowns (those use change).
Remove handlers with .off("select") — not by calling .select(undefined).
For the full modern select event guide — delegation, selected text, and select-all patterns — see the jQuery select event tutorial.
Compatibility
Browser Support
The underlying select event fires on text inputs and textareas in browsers jQuery targets. The .select() method itself is a jQuery API — it works in jQuery 1.x, 2.x, and 3.x. Binding via .select(handler) is deprecated since 3.3 but still functional; triggering via no-arg .select() also remains supported.
✓ jQuery 1.0+
jQuery .select() method
Supported across all jQuery versions you are likely to maintain. Deprecated binding since 3.3 — use .on('select') for new projects. Native equivalent for binding: element.addEventListener('select', fn) on inputs and textareas. Native equivalent for trigger: .trigger('select') or dispatchEvent. Remember: select event ≠ HTML
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
.select()Legacy API
Bottom line: Safe in legacy jQuery projects. Migrate bindings to .on('select') and triggers to .trigger('select') when updating text-selection and select-all button code.
Wrap Up
Conclusion
The jQuery .select() method is the legacy shorthand for binding and triggering select handlers. Use .select(handler) or .select(eventData, handler) to bind — both deprecated since jQuery 3.3. Use no-argument .select() to trigger — equivalent to .trigger("select").
For new code, prefer .on("select", fn) for binding and .trigger("select") for programmatic firing. When you encounter .select() in older editor and toolbar scripts, recognize it, understand it, and migrate when practical. For delegation, selected text, and the complete modern select event workflow, continue with the jQuery select event tutorial.
Write new text-selection handlers with deprecated .select(handler)
Confuse jQuery .select() with HTML <select> dropdown elements
Assume .select() supports delegation — it does not
Confuse .select(fn) (bind) with .select() (trigger)
Use .unbind("select") — it is also deprecated; use .off("select")
Copy deprecated patterns from old tutorials without modernizing them
Summary
Key Takeaways
Knowledge Unlocked
Six things to remember about .select()
Legacy bind, modern migrate.
6
Core concepts
.select01
.select(fn)
Bind
Deprecated
data02
eventData
Since 1.4.3
Handler
()03
.select()
Trigger
No args
.on04
.on("select")
Modern
Replace
⚡05
.trigger()
Fire
Programmatic
3.306
Deprecated
Since 3.3
Migrate
❓ Frequently Asked Questions
The .select() method has two roles. With a handler argument — .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 on each matched element, running bound handlers and typically selecting all text. Both forms have been part of jQuery since 1.0; the binding form is deprecated since 3.3. Do not confuse this with HTML <select> dropdown elements.
Yes — the binding signatures .select(handler) and .select(eventData, handler) are deprecated since jQuery 3.3. Use .on('select', handler) or .on('select', eventData, handler) instead. The no-argument .select() trigger form still works but .trigger('select') is clearer and preferred in modern code. Existing legacy code continues to run in jQuery 3.x; migrate when you touch those files.
.select(handler) registers a callback — it does not fire the event immediately. .select() with no arguments triggers the select event programmatically on every matched element, the same as .trigger('select'), and usually selects all text in the field. The handler form is deprecated for binding; the no-arg form is a trigger shorthand. Always check whether parentheses contain a function before reading legacy jQuery code.
Replace .select(fn) with .on('select', fn). Replace .select(data, fn) with .on('select', data, fn). Replace no-arg .select() with .trigger('select'). Replace .unbind('select') cleanup with .off('select'). Under the hood, .select(handler) already delegates to .on('select') — migration is a straight rename with no behavior change for simple bindings.
Yes. jQuery 3.x keeps .select() for backward compatibility with jQuery 1.x and 2.x codebases. It still binds and triggers correctly. The API docs mark it deprecated to steer new projects toward .on() and .trigger(). Do not use .select(handler) in new code — prefer the modern API covered in the jQuery select event tutorial.
No. jQuery .select() is shorthand for the select event — when users highlight text inside inputs and textareas. HTML <select> dropdown menus use the change event when the user picks a new option. The similar names confuse beginners — this page covers text highlight only.
Did you know?
jQuery unified event binding in version 1.7 with .on() and .off(), replacing shorthand methods like .select(), .change(), and .bind(). The old .select(handler) still works but is deprecated since 3.3 — under the hood it delegates to .on("select"). The separate no-argument .select() remains valid as shorthand for .trigger("select"), though .trigger("select") is clearer in modern code.