Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Textarea value property

Textarea value property

Textarea Object Reference The Textarea object


Example

Modify the text content of the textarea:

document

.

getElementById

(

"

myTextarea

"

)

.

value

=

"

Runoob

"

;

Try it »

Definition and Usage

The value property sets or returns the text of the textarea.

Syntax

Set the value attribute:

textareaObject.value="text"

Return the value attribute:

textareaObject.value


Attribute values

Value Description
text Specifies the content of the text box

Browser support

property
value Yes Yes Yes Yes Yes

Example

Example

Get the text content of the textarea:

var

x

=

document

.

getElementById

(

"

myTextarea

"

)

.

value

;

Try it »


Textarea Object Reference The Textarea object