Search w3schools.com:

SHARE THIS PAGE

Textarea select() Method

Textarea Object Reference Textarea Object

Definition and Usage

The select() method selects the entire contents of a text area.

Syntax

textareaObject.select()


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The select() method is supported in all major browsers.


Example

Example

Select the contents of the text area:

<html>
<head>
<script>
function displayResult()
{
document.getElementById("myTextarea").select();
}
</script>
</head>
<body>

<textarea id="myTextarea" cols="20">
At W3Schools you will find all the Web-building tutorials you need, from basic HTML to advanced XML, SQL, ASP, and PHP.
</textarea>
<br>

<button type="button" onclick="displayResult()">Select contents of text area</button>

</body>
</html>



Textarea Object Reference Textarea Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]