Here you go:
http://mootools.net/shell/kss2C/1/

Note where you attach the click listener (that dom tree will be counted)

Cheers

On Wed, Feb 10, 2010 at 10:41 PM, cbolson <[email protected]> wrote:

> Is it possible to get the index of the element (eg) clicked when using
> event delegation?
>
> Here is my example code:
>
>
> var comments=$$('.answer').hide();
>
> document.id('faq').addEvent('click:relay(.question)', function(){
>        // how to get the "index" of the item clicked so that this
> next line will work?
>       comments[index].show();
> });
>
>
> Code in mooshell:
> http://mootools.net/shell/kss2C/
>
> Thanks in advance for any suggestions, I am probably missing something
> obvious :(
>
> Chris
>



-- 
---
"Make everything as simple as possible, but not simpler."

- Albert Einstein

Reply via email to