In Prototype, you can get the target element itself this way:
function doThis(evt){
var targetElement = Event.element(evt);
alert(targetElement.target);
alert(targetElement.up('div').id);
//or something like that
}
(I have a sneaking suspicion that using event as the variable name
might cause some pain in IE. I usually stick to evt, but that's
probably cargo cult on my part...)
Walter
On Apr 15, 2008, at 10:03 AM, Ian wrote:
> in Prototype, I have this:
>
> Element.observe(document, 'click', doThis);
> function doThis(event){
> var target = $(event.target);
> alert(target);
> }
>
>
> But how do I access the id and/or parent of the target element, so I
> can determine whether or not to close the menu windows?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---