Home
Do you have a label tag for the fields associated with your input?
  v1.0 Posted at 17/12/2014 5:48 AM by Tiago Araujo

When adding input boxes to collect data, please always have a <label> tag associated with your <input> tag to link the labels with their respective edit controls. This improves accessibility and gives nice focusing stuff (when you click the label).

<p>
    <label for="EmailAddress">Email Address</label>
    <input id="EmailAddress" type="text"/>
</p>

Tip: To do this in ASP.NET use the AssociatedControlID parameter on your <asp:Label /> controls.

<p>
    <asp:Label ID="EmailLabel" runat="server" Text="Email Address" AssociatedControlID="EmailAddress"/>
    <asp:TextBox ID="EmailAddress" runat="server"/>
</p>

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments: