Hi, Again, it's WELL WORTH your time to take an hour and read through the API[1]. It will save you quite a lot of time in the long term (probably even the medium term).
You can get this from previousSiblings.[2] Given an element `element`, `element.previousSiblings().length` will tell you how many precede it -- e.g., will give you its index. [1] http://api.prototypejs.org [2] http://api.prototypejs.org/dom/element/previoussiblings/ HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On May 12, 6:16 am, Phonethics <phoneth...@gmail.com> wrote: > 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 > athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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.