jQuery .select() Method

Beginner
⚠️ Deprecated since 3.3
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Form events

What You’ll Learn

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

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.

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.

📝 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:

1. Bind a handler — .select( handler ) (since 1.0, deprecated 3.3)

jQuery
.select( handler )
  • handler — function executed each time select fires: function( event ) { ... }.
  • Returns the jQuery object for chaining.
  • Modern replacement: .on( "select", handler ).

2. Bind with eventData — .select( [eventData], handler ) (since 1.4.3, deprecated 3.3)

jQuery
.select( [eventData], handler )
  • eventData — optional object available in the handler as event.data.
  • Modern replacement: .on( "select", eventData, handler ).

3. Trigger the event — .select() (since 1.0)

jQuery
.select()
  • No arguments — triggers select on every matched element.
  • Runs bound select handlers.
  • Preferred replacement: .trigger( "select" ).

Official jQuery API migration note

jQuery
// Deprecated binding
$( "#target" ).select( function() {
  alert( "Handler for `select` called." );
} );

// Modern binding
$( "#target" ).on( "select", function() {
  alert( "Handler for `select` called." );
} );

// Deprecated trigger
$( "#target" ).select();

// Modern trigger
$( "#target" ).trigger( "select" );

Return value

  • All .select() signatures return the original jQuery object for chaining.
  • Handler return values are ignored unless you use return false (equivalent to preventDefault() + stopPropagation()).

⚡ Quick Reference

GoalLegacy (.select)Modern replacement
Bind select handler$("#target").select(fn)$("#target").on("select", fn)
Pass data to handler$("#bio").select({ toolbar: "basic" }, fn)$("#bio").on("select", { toolbar: "basic" }, fn)
Trigger select programmatically$("#target").select()$("#target").trigger("select")
Trigger all matched inputs$("input").select()$("input").trigger("select")
Remove select handlers$("#target").off("select")$("#target").off("select")
Delegated select on textareas$("#editor").on("select", "textarea", fn) — not available via .select()
Get selected text (input)el.value.substring(el.selectionStart, el.selectionEnd)

📋 .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

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.

jQuery
$( "#target" ).select( function() {
  alert( "Handler for `select` called." );
} );
Try It Yourself

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.

jQuery
$( "#bio" ).select( { toolbar: "basic" }, function( event ) {
  var len = this.selectionEnd - this.selectionStart;
  $( "#out" ).text(
    "Toolbar: " + event.data.toolbar + " | " + len + " chars highlighted"
  );
} );
Try It Yourself

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.

jQuery
var count = 0;

$( "#target" ).select( function() {
  count++;
  $( "#out" ).text( "Target select handler fired (count: " + count + ")" );
} );

$( "#fire" ).click( function() {
  $( "#target" ).select();
} );
Try It Yourself

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." );
} );
Try It Yourself

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" );
  } );
Try It Yourself

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).

🚀 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").
  • Shared eventData$("#editor").select({ toolbar: "basic" }, fn) passes toolbar metadata without closures.
  • 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").

📝 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.

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 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
.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.

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.

💡 Best Practices

✅ Do

  • Use .on("select", handler) for all new select bindings
  • Use .trigger("select") instead of no-arg .select()
  • Migrate .select(fn) to .on("select", fn) when refactoring legacy files
  • Use .off("select") to remove handlers cleanly
  • Read the modern select event tutorial for delegation and selected-text patterns

❌ Don’t

  • 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

Key Takeaways

Knowledge Unlocked

Six things to remember about .select()

Legacy bind, modern migrate.

6
Core concepts
data 02

eventData

Since 1.4.3

Handler
() 03

.select()

Trigger

No args
.on 04

.on("select")

Modern

Replace
05

.trigger()

Fire

Programmatic
3.3 06

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.

Learn the modern select event API

Prefer .on("select") and .trigger("select") — full tutorial with five try-it labs.

select event 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