This example demonstrates how to assign an "onselect" event to an input element.
<!DOCTYPE html> <html> <body> Select some text: <input type="text" value="Hello world!" onselect="myFunction()"> <p id="demo"></p> <script> function myFunction() {/*from w ww . java2s . c o m*/ document.getElementById("demo").innerHTML = "You selected some text!"; } </script> </body> </html>
Bubbles: Cancelable: Event type: Supported HTML tags: | No No UiEvent if generated from a user interface, Event otherwise <input type="file">, <input type="password">, <input type="text">, and <textarea> |
---|