Textarea placeholder attribute
Definition and Usage
placeholder
Sets or returns the placeholder attribute value of the text area.
The HTML placeholder attribute specifies a short hint that describes the expected value of the text area (such as a sample value or a brief description of the expected format).
The hint will be displayed in the empty text area and disappear when the field gains focus.
See also:
HTML Reference Manual:HTML <textarea> placeholder Attribute
Example
Example 1
Change the placeholder text of the text area:
document.getElementById("myTextarea").placeholder = "Where do you live?";
Example 2
Get the placeholder text of the text area:
var x = document.getElementById("myTextarea").placeholder;
Syntax
Return placeholder attribute:
textareaObject.placeholder
Set placeholder attribute:
textareaObject.placeholder = text
Attribute Value
Value | Description |
---|---|
text | Specifies a brief hint (word or phrase) describing the expected value of the text area. |
Technical Details
Return Value: | A string value that represents a brief hint of the expected value of the text area. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |