On 6/3/07, Rick Pasotto <rick at niof.net> wrote: > > How do I access the <label> element associated with an <input>? > I'd like to add a class to change the background if validation fails. 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. 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). -- Anthony Ettinger Ph: 408-656-2473 var (bonita, farley) = new Dog; farley.barks("very loud"); bonita.barks("at strangers"); http://chovy.dyndns.org/resume.html http://utuxia.com/consulting -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070604/3efa921f/attachment.htm>