Text select() Method

Definition and Usage
The select() method is used to select the content of a text field.
Syntax
textObject.select()
Browser Support
The select() method is supported in all major browsers.
Example
Example
Select the content of a text field:
<html>
<head>
<script>
function myFunction()
{
document.getElementById("email").select();
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email" value="someone@example.com" />
</form>
<button type="button" οnclick="myFunction()">Select content</button>
</body>
</html>
<head>
<script>
function myFunction()
{
document.getElementById("email").select();
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email" value="someone@example.com" />
</form>
<button type="button" οnclick="myFunction()">Select content</button>
</body>
</html>