Wednesday, December 23, 2009

Re: [jQuery] Re: how to access elements with index in for-loop

The index is passed as the first argument to the callback function you provide to .each.

- Richard

On Wed, Dec 23, 2009 at 8:49 PM, Eric Zhong <ericiszhongwenjia@gmail.com> wrote:


2009/12/24 Richard D. Worth <rdworth@gmail.com>

What about using .each?

http://docs.jquery.com/Core/each#callback

- Richard


On Wed, Dec 23, 2009 at 8:34 PM, Eric Zhong <ericiszhongwenjia@gmail.com> wrote:


2009/12/24 Eric Zhong <ericiszhongwenjia@gmail.com>

when i use for-loop to access elements with array index or get() method it doesn't work.
but i have to  use the index to access, what happen please .


ok:          http://jsbin.com/olego
wrong:     http://jsbin.com/ulixu

wrong:        http://jsbin.com/axugi


thank you, i have tested .each(), it works well , but i need the index,
may be the .each() can carry out too, but i think the index will more simple.


No comments: