7.2. Use the
title attribute to label form fields that don’t have a visible label
To label form fields that don’t have a visible label:
titleto the field.
- Populate the attribute by specifying the field’s function.
<input type="search" title="Your search" name="search" /> <input type="submit" value="Search" />
<select title="Filter news" name="filter"> <option>By Date</option> <option>By Topic</option> […] </select>
placeholder attribute cannot be used as a label because it disappears during text entry.
It can be used for secondary text entry aids that are not essential for understanding the field. If the
title attribute is present, the
placeholder attribute must have the same value.
Find out more
Add a comment
- 10 December 2021
- In the placeholder section, the code example has been removed and the text has been updated for clarity.
- 20 January 2022
- In the select tag example, the aria-label attribute has been replaced by the title attribute