Textarea placeholder attribute
Definition and Usage
placeholder
Sets or returns the value of the placeholder attribute of the text area.
The HTML placeholder attribute specifies a brief hint describing the expected value of the text area (for example, a sample value or a brief description of the expected format).
The hint will be displayed in an empty text area and disappear when the field gains focus.
See also:
HTML Reference Manual:HTML <textarea> placeholder-Attribut
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
Attributwert
Wert | Beschreibung |
---|---|
text | Definiert eine kurze Erklärung des erwarteten Wertes des Textareas (Wort oder Phrase). |
Technische Details
Rückgabewert: | Zeichenfolgenwert, der eine kurze Erklärung des erwarteten Wertes des Textareas beschreibt. |
---|
Browserunterstützung
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Unterstützung | 10.0 | Unterstützung | Unterstützung | Unterstützung |