On Nov 18, 2:00 pm, Eric <[email protected]> wrote:
> Hi,
>
> I also think delegation is the better approach.
> However, I did notice that none of the examples was dealing with the
> case where the user click on something that is not a '.item'.
>
> You may want to do something like this:
>
> function doIt(e) {
>   var element = e.findElement('.item');
>   if(element != document)
>   {
>     var id = element.id;
>     // Do your stuffs here
>   }
>
> }
>

You're right - in fact, my example was wrong. I believed that
Event.findElement took a CSS selector, but it actually takes a
tagname, so e.findElement('.item') won't work.

Instead I would use

var element = e.element().up('.item').

which I think is easier than your suggestion.

--

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].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=.


Reply via email to