[thelist] Radio button / text association

Jeff Howden jeff at jeffhowden.com
Wed Jul 27 12:57:15 CDT 2005


Sam,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Sam Carter
> 
> <label for="mybutton">Click here for pazaaz!</label>
> <input name="mybutton" type="radio"  value="pazaaz"
>  checked>
> 
> Netscape and Firefox will allow the user to set the
> radio button by clicking on the label text.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

If they do, that's non-standard behavior.  Because...

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> Is there a method to achieve same result in IE?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

The value of the "for" attribute of the <label> element must match the value
of the "id" attribute of the form element you wish to explicitly bind it to.
Without that there's only an implicit binding possible and that's
accomplished by nesting the form element *within* the body of the <label>
tag.

As the support for implicit binding in the browsers that support the <label>
tag is not 100% and the support for explicit binding in those same browsers,
the explicit method is far more desirable.

 [>] Jeff Howden
     jeff at jeffhowden.com
     http://jeffhowden.com/



More information about the thelist mailing list