<br><br><div><span class="gmail_quote">On 6/3/07, <b class="gmail_sendername">Rick Pasotto</b> <<a href="mailto:rick@niof.net">rick@niof.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How do I access the <label> element associated with an <input>?<br>I'd like to add a class to change the background if validation fails.</blockquote><div><br><br>Perhaps getting the ID of the input field and then finding all labels and checking their "for" attributes? Or as mentioned,
input.parentNode if wrapped properly.<br><br>I typically don't use js for validation, and assign a class as I throw any errors in validation back to the UI (this should be done anyway, so I find it redundant to also do it in js).
<br><br><br></div></div><br clear="all"><br>-- <br>Anthony Ettinger<br>Ph: 408-656-2473<br>var (bonita, farley) = new Dog;<br>farley.barks("very loud");<br>bonita.barks("at strangers");<br><br><a href="http://chovy.dyndns.org/resume.html">
http://chovy.dyndns.org/resume.html</a><br><a href="http://utuxia.com/consulting">http://utuxia.com/consulting</a>