Nos bénévoles n'ont pas encore traduit cet article en Français. Inscrivez-vous et aidez-nous à réaliser cette tâche !
Vous pouvez également lire cet article en English (US).

An event handler for the select event on the window.


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.


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


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

Browser Compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) ? ? ? ?
Feature Android Android Webview Chrome for Android Edge Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support ? (Yes) (Yes) (Yes) ? ? ? ? ?

Étiquettes et contributeurs liés au document

 Dernière mise à jour par : erikadoyle,