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

Textarea placeholder property

Textarea placeholder property

Textarea Object Reference The Textarea object


Example

Modify the placeholder property of the textarea (expected value):

document

.

getElementById

(

"

myTextarea

"

)

.

placeholder

=

"

Enter search keyword...

"

;

Try it »

Definition and Usage

The placeholder property is used to set or return the value of the placeholder property of the textarea element.

The placeholder property specifies a brief hint used to describe the expected value of the textarea element.

The placeholder displays a brief hint when the textarea element value is empty, and disappears when the textarea element gets focus.


Browser support

property
placeholder Yes 10.0 Yes Yes Yes

Syntax

Return the placeholder property:

textareaObject.placeholder

Set the placeholder property:

textareaObject.placeholder = text


Attribute values

Value Description
number

A string, representing the expected value of the textarea element.


Technical Details

Return value: A string, the expected value of the textarea element.

More examples

Example

Get the value of the placeholder property of the textarea (expected value):

var

x

=

document

.

getElementById

(

"

myTextarea

"

)

.

placeholder

;

Try it »


Textarea Object Reference The Textarea object