<input id="test" type="text" value="Text" /> <script type="text/javascript"> document.getElementById("test").onclick = function() { this.select(); }; </script>