I have something like:

<div id="outer">
   <span>the text</span>
   <a href="javascript:void(0);">the link</a>
</div>

I then observe the link as...

$('outer').observe('click', doSomething);

and deal with it as...

function doSomething(e) {
        e.stop();
        elt = e.element();
        if(elt.tagName == 'A') {
                alert(elt.up().firstChild.innerHTML);
        }
}

That brings me to my question. The user clicked on the 'A' link, so I  
want to alert the text that's in the adjoining span. I walked up to  
the div, then down to the first child node (I guess previous() would  
have worked...). Anyhow, the only way I know to get the information  
in the span is using innerHTML, but something tells me there is a  
portability bug waiting to bite me.

Any help is appreciated.

Thx

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to