Textarea placeholder-eigenschap

Definitie en gebruik

placeholder Stel de eigenschap in of geef de waarde van de placeholder-eigenschap van de tekstregio terug.

De HTML placeholder-eigenschap specifies a brief hint (such as a sample value or a short description of the expected format) for the expected value of the text area.

De tip wordt weergegeven in een lege tekstregio en verdwijnt wanneer het veld focus krijgt.

Zie ook:

HTML Referentiemanual:HTML <textarea> placeholder attribute

Voorbeeld

Voorbeeld 1

Wijzig de placeholder-tekst van de tekstregio:

document.getElementById("myTextarea").placeholder = "Where do you live?";

Probeer het zelf uit

Voorbeeld 2

Haal de placeholder-tekst van de tekstregio op:

var x = document.getElementById("myTextarea").placeholder;

Probeer het zelf uit

Syntaxis

Geef de placeholder-eigenschap terug:

textareaObject.placeholder

Stel de placeholder-eigenschap in:

textareaObject.placeholder = text

Attribute value

Value Description
text Specifies a brief hint (word or phrase) for the expected value of the text area.

Technical details

Return value: String value, indicating a brief hint for 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