November 13, 2009
Setting the label “for” attribute with JavaScript
Category: HTML, JavaScript, Tags: HTML, JavaScript, khadlock at 10:53 am
Sometimes JavaScript offers unique names for element attributes, for example, CSS properties with words that are normally separated with dashes are camel case in JavaScript.
The label element's "for" attribute is no exception, in fact it's probably the most unique one I've stumbled across, which is why I thought it was important to share. When you set the label "for" attribute with JavaScript you have to set it as "htmlFor" and of course give it the same value as the input element's id that you are tying it to.
One Response to “Setting the label “for” attribute with JavaScript”
Leave a Reply

Social comments and analytics for this post…
This post was mentioned on Twitter by khadlock: Setting the label ?for? attribute with JavaScript http://tinyurl.com/yk67zj5…