7.4. Add help text directly to the <label> tags

Help text must be included in the <label> tags.

This particularly applies to:

<label for="date">
   Date of Birth
   <span>(MM/DD/YYYY)</span>
</label>
<input type="date" id="date" name="date" autocomplete="bday" />
<label for="number">
    Your client number
    <input type="text" id="number" name="number" aria-required="true" />
    <span>i.e., BT-VZ</span>
</label>

Note

In some cases, because of a specific design layout for example, the help text cannot be included in the <label>.

In these cases:

  1. Add the id attribute to the tag containing the help text.
  2. Populate the id with a unique value.
  3. Add the aria-describedby attribute to the corresponding field.
  4. Populate aria-describedby with the id value included in the help text.
<label for="document">
   Add a document to your case
</label>
<input type="file" id="document" name="document" aria-describedby="formats" />
<h2>Documents currently in your case</h2>
<ul>
   <li>CV</li>
   <li>Cover Letter</li>
</ul>
<p id="formats">Accepted formats: pdf or doc.</p>

Note that the aria-describedby attribute can reference several id values.

Warning

The placeholder attribute must not be used for entry aids that are essential for understanding the type of data to be entered.

It must be used only for secondary entry aids, that are not essential for understanding the field.

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.

Back to top