Javascript examples for DOM Event:Element Event Attribute
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").onselect = function() {myFunction()}; function myFunction() {//from w ww. ja v a 2 s. c o m document.getElementById("demo").innerHTML = "You selected some text!"; } </script> </body> </html>