The onselect property of the GlobalEventHandlers mixin is an EventHandler that processes select events.

The select event only fires when text inside a <input type="text"> or <textarea> is selected. The event is fired after the text has been selected.


window.onselect = funcRef;
  • funcRef is a function.



<title>onselect test</title>

<style type="text/css">
  .text1 { border: 2px solid red; }

<script type="text/javascript">
window.onselect = selectText;

function selectText() {
  alert("select event detected!");

<textarea class="text1" cols="30" rows="3">
Highlight some of this text
with the mouse pointer
to fire the onselect event.


Specification Status Comment
HTML Living Standard
The definition of 'onselect' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE ? Opera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?


Full support  
Full support
Compatibility unknown  
Compatibility unknown

Document Tags and Contributors

Last updated by: mfluehr,