select

Test page.

Events overview page.

The select event fires when the user selects text in a text input. It should also fire when the user selects text elsewhere.

But when does this event fire?

  1. IE 8 and lower fire the event once for every character that’s added to the selection, whether the user uses the mouse or the keyboard.
  2. All other browsers, including IE9 and 10, copy this behaviour for the keyboard, but not for the mouse. When the user uses a mouse they fire the event when a mouseup occurs after the user has selected text.
Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
On the window
No Yes Yes Yes Yes Yes

Is this event available on the window?

On the document
No Yes Yes Yes Yes Yes

Is this event available on the document?

On a form
No Yes Yes Yes Yes Yes

Is this event available on a form?

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
On text inputs
Yes Yes Yes Yes Yes

The point of this event.

On any element
No Yes No No No No

It stands to reason that selecting text on any element (such as a paragraph) should also fire the event. When that happens, pass the resulting Range object as a property of the event object, please.

Event bubbling

The event should bubble.

Untestable Yes Yes Yes Yes Yes
Prevent default
“No” is the correct answer
No No No No No

The default action cannot be prevented.

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac