The placeholder attribute is applied to an input field in order to display optional hint text that is visible when the field has no value. Entering a value into the field causes the placeholder text to disappear until the input value is removed.

Syntax:

<input type="text" name="query" placeholder="Enter a search query..." />

Elements:

Example

The placeholder attribute example:

 

›› go to examples ››