Textarea placeholder property
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 »
The Textarea object