WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: label tag with form elements

for

From: Graham Armfield
Date: Mar 13, 2015 11:30AM


I use that construct if I want to put error messages after the input field,
but still within the label.

Eg:
<label for="email">Your email address
<input type="text" id="email"><br>
<span class="error">Please check email format</span></label>

Regards
Graham
On 13 Mar 2015 15:05, "Mickey Williamson" <
<EMAIL REMOVED> > wrote:

> Excellent. Thank you!
>
> On Fri, Mar 13, 2015 at 9:12 AM, Steve Faulkner < <EMAIL REMOVED> >
> wrote:
>
> > >
> > > Any benefit
> >
> >
> > no
> >
> > --
> >
> > Regards
> >
> > SteveF
> > HTML 5.1 <http://www.w3.org/html/wg/drafts/html/master/>;
> >
> > On 13 March 2015 at 13:09, Mickey Williamson <
> > <EMAIL REMOVED> > wrote:
> >
> > > If you're using the "for" attribute in the label tag, is there any
> reason
> > > to also wrap the input in the label tag?
> > >
> > > Any benefit to this:
> > >
> > > <label for="myinput">Label text<input id="myinput" type="text"
> > > name="textfield"></label>
> > >
> > > over this:
> > >
> > > <label for="myinput">Label text</label>
> > > <input id="myinput" type="text" name="textfield">
> > >
> > > Thanks,
> > > Mickey
> > > > > > > > > > > >
> > > > > > > >
>
>
>
> --
>
>
> Michelle Williamson
> Drupal Developer
> T 678.580.1690 x205 F 770.360.5776
> twitter <http://twitter.com/micnap>; * linkedin
> <http://www2.mediacurrent.com/l/10072/2012-03-23/3qknq>; * mediacurrent
> <http://www2.mediacurrent.com/l/10072/2012-03-23/3qkpd>;
>
> Awarded Best SMB
> <
> https://t.yesware.com/tl/6228584989751eec7f7efd759b5a3987de150a8e/2db8247480f6e405a199c3227c223214/40a213898e1bbb2949c481a66986bb61?ytl=http%3A%2F%2Fwww.mediacurrent.com%2Fblog%2Fdrupal-agency-mediacurrent-awarded-best-overall-smb-salesforce
> >
> by Salesforce.com
> > > >