Thanks!
On Sep 9, 2:28 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > You can use a CSS selector. just add ".formrow" to the selector you > already have: > > jQuery(this).parents("div.formrow:eq(0)").addClass('highlighted'); > > http://docs.jquery.com/Selectors > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Sep 9, 2008, at 6:16 AM, rudgr wrote: > > > > > > > Hi, > > > I have the code below to add a highlight class to the parent div if an > > input field gets focus > > > --------- > > jQuery(this).parents("div:eq(0)").addClass('highlighted'); > > ---------- > > <div class="formrow"> > > <input type="text"> > > </div> > > ---------- > > > This works fine, but I would like to further specify the filter > > expression in the parents() function to only include divs that have > > the attribute class="formrow": > > > parents("div:eq(0)") > > > Is this possible? > > > PS: Sorry, I'm relatively new to jQuery, so if there's a better way to > > do this I'd like to hear it! > > > Thanks in advance, > > > rudgr- Hide quoted text - > > - Show quoted text -