html5 - Should I use the "for" attribute for <label> when I'm using it to label a text field or is it not necessary? -
when use checkbox or radio input, use attribute, needed when want label text input or input other checkbox / radio?
absolutely. not programmatically connect label text input (so screenreader users told text input for), increase 'click' area input, clicking (or tapping) on label set users focus corresponding field. if don't want use 'for' attribute whatever reason, can wrap text input in label well.
<label> text input <input type="text" /> </label>
this have same effect increasing click area.
Comments
Post a Comment