Javascript examples for DOM Event:addEventListener
The onselect event occurs after some text has been selected in an element.
Bubbles | No |
---|---|
Cancelable | No |
Supported HTML tags: | <input type="file">, <input type="password">, <input type="text">, and <textarea> |
<!DOCTYPE html> <html> <body> Select some text: <input type="text" value="Hello world!" id="myText"> <p id="demo"></p> <script> document.getElementById("myText").addEventListener("select", myFunction); function myFunction() {/*from w w w . j a v a 2s. c om*/ document.getElementById("demo").innerHTML = "You selected some text!"; } </script> </body> </html>