Maybe something like:
$('.colorPick').change(function() { $(this).parent().parent().addClass('assigned'); }); where colorPick is the class assigned to your select menu. You could also use: $('.colorPick').change(function() { $(this).parents('tr').addClass('assigned'); }); but my gut tells me that's not quite as efficient, as it will look for 'tr' elements all the way up to the top of the DOM tree. Seb On 5 Mar 2007, at 17:09, Kevin Fricovsky wrote: > > Morning, > > I have a question for the jquery group. > > My question is - what's the best way to get a single parent element of > the current object. > > Right now I have an html table with multiple rows. In the first TD of > each row I have a select list (a dropdown). > > I have a select() event attached to the option list and when the user > selects an option the background color for that row (TR) is changed. > (well, actually all TR backgrounds are changing right now that's > why I'm > writing everyone). > > So, the only problem I'm having is getting the single parent TR. > > Right now my update statement is updating every TR in the table versus > just the parent. > > The code is something like this: > > $("../../../../tr",this).addClass("assigned"); > > The "this" is the select element. > > Even if I do use an indexer on this statement like this $(...)[0] - > the > problem there is the system currently doesn't know the index of the > row > it's on. > > So I can either add the index in a hidden value or I thought maybe > there's an easier way of doing this via JQuery. > > Thx for your help. > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/