for Attributefor AttributeThe for attribute may be specified on the
label element
and should be given the id
attribute of the form control for which is it a label. This creates
an explicit association between the label
and the form control.
This association allows user agents to implement such features
as bringing the relevant form control into focus when the user clicks on the
its label. This is
particularly useful for
input type="checkbox"
and input type="radio"
where, in many user agents, clicking on the label
is equivalent to clicking on the radio button or checkbox itself (these controls tend
to be rather small so this facility can make them easier to use).
An alternative method of associating a form control
with a label
is to include the form control within the
label's content.
This is less flexible than using the for
attribute, however.