<html>
<body>
<h2>Use select() to select the content of a Text Field</h2>
Name: <input type="text" id="myText" value="Mickey">
<p>Click the button to select the content of the text field.</p>
<button type="button" onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("myText").select();
}
</script>
</body>
</html>