Is there a way to know the index of the element relative to the parent
as in jQuery ?

document.observe("dom:loaded", function()
{
    $$('#block1 > a').invoke('observe','click',function(e)
    {
        alert($(this).index()); // If Click 3 is clicked, it should
alert 3
    });
});

<div id="block1">
<a href="#">Click 1</a>
<a href="#">Click 2</a>
<a href="#">Click 3</a>
<a href="#">Click 4</a>
<a href="#">Click 5</a>
</div>

-- 
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