Testing the placeholder attribute

The placeholder attribute defines the text displayed in a form control when the control has no value. The placeholder text should provide a brief hint to the user as to the expected type of data that should be entered into the control.

The placeholder attribute should not be used for labelling form controls, or to provide instructions as it is not persistent. It disappears as soon as the user begins typing.

Example 1 - instructions using the placeholder

<label for="date1">Choose a date</label>
<input id="date1" type="text" placeholder="DD/MM/YY">

Example 2 - persistent instructions

DD/MM/YY
<label for="date2">Choose a date</label>
<div id="help">DD/MM/YY</div>
<input id="date2" type="text" aria-describedby="help">