Tryit Editor v1.4

<html> <head> <script type="text/javascript"> function selText() { document.getElementById("myText").select(); } </script> </head> <body> <form> <input size="25" type="text" id="myText" value="A cat played with a ball"> <input type="button" value="Select text" onclick="selText()"> </form> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself