<br><br><div><span class="gmail_quote">On 6/3/07, <b class="gmail_sendername">Rick Pasotto</b> &lt;<a href="mailto:rick@niof.net">rick@niof.net</a>&gt; 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 &lt;label&gt; element associated with an &lt;input&gt;?<br>I&#39;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 &quot;for&quot; attributes? Or as mentioned, 
input.parentNode if wrapped properly.<br><br>I typically don&#39;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(&quot;very loud&quot;);<br>bonita.barks(&quot;at strangers&quot;);<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>