Input Text placeholder Attribute

Definition and Usage

placeholder Sets or returns the value of the placeholder attribute of the text field.

The HTML placeholder attribute specifies a brief hint that describes the expected value of the text field (for example, a sample value or a brief description of the expected format).

A short hint is displayed in the text field before the user enters a value.

See also:

HTML Reference Manual:HTML <input> placeholder Atyakdang

Example

Example 1

Change the placeholder text of the text field:

document.getElementById("myText").placeholder = "Type name here..";

Try it yourself

Example 2

Get the placeholder text of the text field:

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

Try it yourself

Syntax

Return the placeholder attribute:

textObject.placeholder

Set the placeholder attribute:

textObject.placeholder = text

Halaga ng Atyakdang

Halaga Paglalarawan
text Tinutukoy ang maikling pagpahintulot sa inaasahang halaga ng teksto ng sangkap (salita o salitang maikling pahintulot).

Teknolohikong Detalye

Halimbawa ng Balaan: String value, kung saan ay naglalarawan ng maikling pagpahintulot sa inaasahang halaga ng teksto ng sangkap.

Browser Support

Ang numero sa tabliya ay inilarawan ang unang bersyon ng browser na ganap na sumusuporta sa katangian.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support