up() looks for a matching ancester in the DOM, not a sibling (brother)
that was before it in the DOM.
I think this will work :

$('part-47').up().down('tr.sd_type').id

On 17 août, 22:47, Rhiq <ndba...@gmail.com> 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">
>    <td class="sd_type">Type: Test Type</td>
>    <td>
>       <a href="#" onclick="renameType(18)">Rename</a> |
>       <a href="#" onclick="addPart(18)">Add Part</a> |
>       In Use (3)
>    </td>
> </tr>
> <tr id="part-43" class="sd_part ChildOfType18 ChildOfClass10
> ChildOfCat8">
>    <td class="sd_part">Part: dfgdfg (0)</td>
>    <td>
>       <a href="#" onclick="renamePart(43)">Rename</a> |
>       <a href="#" onclick="removePart(43)">Remove</a>
>    </td>
> </tr>
> <tr id="part-46" class="sd_part ChildOfType18 ChildOfClass10
> ChildOfCat8">
>    <td class="sd_part">Part: sdfgs (0)</td>
>    <td>
>       <a href="#" onclick="renamePart(46)">Rename</a> |
>       <a href="#" onclick="removePart(46)">Remove</a>
>    </td>
> </tr>
> <tr id="part-47" class="sd_part ChildOfType18 ChildOfClass10
> ChildOfCat8">
>    <td class="sd_part">Part: fdsgre (0)</td>
>    <td>
>       <a href="#" onclick="renamePart(47)">Rename</a> |
>       <a href="#" onclick="removePart(47)">Remove</a>
>    </td>
> </tr>
>
> If I try the following:
> alert($('part-47').up('tr.sd_type').id) I get an error saying that it
> is undefined.
>
> Does it make sense to anyone what I am trying to do?  Is there a way
> for me to do what I would like?
>
> I am trying to make changes to the first <tr> with the class "sd_type"
> above the current <tr> (in this case tr#part-47).
>
> Any help would be awesome.
> Nathan

-- 
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 prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to