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:

  1. Add title to the field.
  2. 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>

Warning

The 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

Comments

Add a comment

All fields are mandatory.

Updates

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

Back to top