Textarea defaultValueProperty

Textarea 对象参考手册Textarea Object

Examples

Modify the default value of the textarea element:

document.getElementById("myTextarea").defaultValue = "Example";

Try it Yourself »

Definition and Usage

The defaultValue property sets or returns the initial content of a text area.

Note:The initial value of a text area is the text placed between the <textarea> and </textarea> tags. When the form is reset, the text area is restored to this value. Changing the value of this property changes the text currently displayed in the text area.



Browser Support

Property
defaultValue Yes Yes Yes Yes Yes

Syntax

Set the defaultValue property:

textareaObject.defaultValue = text

Return the defaultValue property:

textareaObject.defaultValue

Tip:The defaultValue property has no default value.



Property Values

Value Description
text Specifies the default value of the text area


Technical Details

Return Value: A string, representing the default value of the textarea element.

More Examples

Example

Get the default value of the textarea element:

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

Try it Yourself »


Textarea 对象参考手册Textarea Object

Other Extensions