WebAIM - Web Accessibility In Mind

E-mail List Archives

label tag with form elements

for

From: Mickey Williamson
Date: Mar 13, 2015 7:09AM


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