THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Textarea defaultValue Property

Textarea Object Reference Textarea Object

Example

Change the default value of a text area:

document.getElementById("myTextarea").defaultValue = "Fifth Avenue, New York City";
Try it yourself »

Definition and Usage

The defaultValue property sets or returns the default value of a text area.

Note: The default value of a text area is the text between the <textarea> and </textarea> tags.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The defaultValue property is supported in all major browsers.


Syntax

Return the defaultValue property:

textareaObject.defaultValue

Set the defaultValue property:

textareaObject.defaultValue=text

Property Values

Value Description
text Specifies the default value (contents) of the text area

Technical Details

Return Value: A String, representing the default value of the text area

More Examples

Example

Get the default value of a text area:

var x = document.getElementById("myTextarea").defaultValue;

The result of x will be:

342 Alvin Road
Ducksburg
Try it yourself »

Textarea Object Reference Textarea Object