Input Search placeholder attribute

Definition and Usage

placeholder Set or return the value of the placeholder attribute of the search field.

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

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

See also:

HTML Reference Manual:HTML <input> placeholder Atribute

Example

Example 1

Change the placeholder text of the search field:

document.getElementById("mySearch").placeholder = "Search image";

Try it yourself

Example 2

Get the placeholder text of the search field:

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

Try it yourself

Syntax

Return placeholder attribute:

searchObject.placeholder

Set placeholder attribute:

searchObject.placeholder = text

Halaga ng Atribute

Halaga Paglalarawan
text Tinutukoy ang maikling pagtutukoy (salita o salitang maikling pangungusap) ng inaasahang halaga ng search field.

Detalye ng Teknolohiya

Halaga ng Pagbabalik: String na halaga, naglalarawan ng maikling pagtutukoy ng inaasahang halaga ng search field.

Suporta ng Browser

Ang numero sa talahanayan ay naglalarawan ng unang bersyon ng browser na ganap na sumusuporta sa katangian na iyon.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Suporta 10.0 Suporta Suporta Suporta