Javascript DOM HTML Input Text handle select event
<!DOCTYPE html> <html> <body> Select some text: <input type="text" value="Hello world!" onselect="myFunction()"> <p id="demo"></p> <script> function myFunction() {/*w ww . j ava 2s . c om*/ document.getElementById("demo").innerHTML = "You selected some text!"; } </script> </body> </html>