On Tue, Aug 17, 2010 at 1:47 PM, Rhiq <[email protected]> wrote:
> I obviously don't get the way up() works.  Using the generated HTML
> below:
>
> <tr class="sd_type ChildOfClass10 ChildOfCat8 open" id="type-18">
[snip]
> </tr>
[snip]
> <tr id="part-47" class="sd_part ChildOfType18 ChildOfClass10
> ChildOfCat8">
[snip]
> </tr>

> If I try the following:
> alert($('part-47').up('tr.sd_type').id) I get an error saying that it
> is undefined.

Yes.  the two table rows are siblings.  +up+[1] moves up the DOM tree,
so it will find ancestors.

>
> Does it make sense to anyone what I am trying to do?  Is there a way
> for me to do what I would like?

Yes.  You want +previous+[2] which lets you find the first (previous)
sibling that matches a given selector.

[1] http://api.prototypejs.org/dom/element/up/
[2] http://api.prototypejs.org/dom/element/previous/

-- 
med vänlig hälsning
David JH

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to