Yes, exactly! I knew it was in there somewhere, but I couldn't find
the ref.
Walter
On Feb 1, 2011, at 3:37 AM, Marc wrote:
The function you pass to each has a second optional index param:
$$('.foo').each(function(elem, index) {
elem.update('I am element ' + index);
});
It's not all that clear in the docs but it's mentioned for the
iterator param here:
http://api.prototypejs.org/language/Enumerable/prototype/each/
Is that wat you were looking for?
-- Marc
On Feb 1, 12:12 am, Walter Lee Davis <[email protected]> wrote:
I have an extended array, result of $$('.foo'). Given a single member
of that array as an object, how do I find the next element in that
array, or the first if the next would wrap?
I could swear there used to be an operator that worked over an
enumerable and maintained an index element as you went, so you could
reference by position within the enumerable, but I can't find it by
hunting in the documentation. Can anyone help me out?
Thanks,
Walter
--
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]
.
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.