On 3/5/07, Kevin Fricovsky <[EMAIL PROTECTED]> wrote:
>
> Morning,

Evening ;)

> 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.

There is.

$(this).parent("tr").addClass("assigned");



-- 
Choan
<http://choangalvez.nom.es/>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to