Javascript examples for DOM Event:onselect
Using the select() method to select content of a text field. to trigger onselect event
<!DOCTYPE html> <html> <body> <input type="text" id="myText" value="Some text.." onselect="myAlertFunction()"> <button type="button" onclick="mySelectFunction()">Select content</button> <script> function mySelectFunction() {// www. j av a 2 s . c o m document.getElementById("myText").select(); } function myAlertFunction() { console.log("You selected some text!"); } </script> </body> </html>