It is failing WAVE validation because you've misunderstood what the for
attribute on <label>
element is for.
If you wrap a <label>
around the control, then the control is automatically associated with that label, and you should not put a for
attribute. This method is outdated, and it should not be used, but it still can be done.
If you do NOT wrap the control within the <label>
then the for
attribute should be the id
of the control that it is associated with.
For instance...
<label>
Select:
<select id="view">
...
</select>
</label>
OR...
<label for="view">
Select:
</label>
<select id="view">
...
</select>
You appear to be using for
as if it will become a tooltip message (if this is what you meant, then use a title
attribute instead). Please note, that the title
attribute is sometimes read instead of the <label>
, so it can cause confusion.