Textarea defaultValue Property

❮ Textarea Object

Example

Change the default value of a text area:

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

Description

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

Property
defaultValue Yes Yes Yes Yes Yes

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;
Try it Yourself »

❮ Textarea Object
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.