Focusing on HTML forms fields through a link
I inquired earlier today if there was a way to give focus to an HTML form field through a simple link.
The reason of my inquiry was that WCAG 2.0 recommends to make it possible for the user [to] easily navigate to [detected form submission errors] to fix the problem
.
But in practice, with the following HTML form:
<p><label for='email' id='emaillabel'>Email:</label>
<input type='text' id='email' name='email'></p>
neither a link to #email nor to #emaillabel will give focus to the input field.
For instance, it would be useful to be able to markup a possible error message above that form as follows: