Javascript examples for DOM HTML Element:Textarea
The value property sets or gets the contents of a text area, which is the text between the <textarea> and </textarea> tags.
Set the value property with the following Values
Value | Description |
---|---|
text | Sets the value (contents) of the text area |
A String, representing the contents/text of the text area
The following code shows how to change the contents of a text area:
<!DOCTYPE html> <html> <body> Address:<br> <textarea id="myTextarea"> Main Street//from w w w . j av a 2 s . c o m New York</textarea> <button type="button" onclick="myFunction()">Test</button> <script> function myFunction() { document.getElementById("myTextarea").value = "new value"; } </script> </body> </html>