Easy Tutorial
❮ Event Onloadedmetadata Dom Obj Area ❯

defaultValue Property of Textarea

Textarea Object

Example

Modify the default value of a textarea element:

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

Definition and Usage

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

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


Browser Support

Property Chrome Edge Firefox Safari Opera
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 Value

Value Description
text Specifies the default value of the text box

Technical Details

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


More Examples

Example

Get the default value of a textarea element:

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

Textarea Object

❮ Event Onloadedmetadata Dom Obj Area ❯