[jQuery] Correct way to get the nth item?

2006-11-23 Thread George Adamson
If your jquery results array is in a variable (to reuse it instead of re-querying over and over again) then what is the best way to get the nth item from it *without modifying the array* ? For instance the following would cause the myElements variable to end up containing only one item! var

Re: [jQuery] Correct way to get the nth item?

2006-11-23 Thread Matt Stith
i think element[n] would be the best, but im no expert. On 11/23/06, George Adamson [EMAIL PROTECTED] wrote: If your jquery results array is in a variable (to reuse it instead of re-querying over and over again) then what is the best way to get the nth item from it *without modifying the

Re: [jQuery] Correct way to get the nth item?

2006-11-23 Thread Blair McKenzie
There is an undocumented feature of jQuery where destructive methods (like eq()) will accept a callback function as a second argument. That function will have the new selection as 'this', but other methods on the chain will still be using the origonal selection. i.e. $(div).eq(n,function(){

Re: [jQuery] Correct way to get the nth item?

2006-11-23 Thread Aaron Heimlich
On 11/23/06, George Adamson [EMAIL PROTECTED] wrote: - $(myElements[n]) If you want to wrap the nth element of myElements in a jQuery object, then that looks like the way to go. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com

Re: [jQuery] Correct way to get the nth item?

2006-11-23 Thread Jörn Zaefferer
Blair McKenzie schrieb: There is an undocumented feature of jQuery where destructive methods (like eq()) will accept a callback function as a second argument. That function will have the new selection as 'this', but other methods on the chain will still be using the origonal selection. i.e.