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

2009-12-24 Thread johan
Actually, I think this bring much more clarity // recommended way by documentation since it's easier to read $(document).ready(function(){ // For easier reading, don't mix too much css-expressions. This will also be much faster to the sizzle-engine to interpretate // The css-method is also

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

2009-12-23 Thread Eric Zhong
2009/12/24 Eric Zhong ericiszhongwen...@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:

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

2009-12-23 Thread Richard D. Worth
What about using .each? http://docs.jquery.com/Core/each#callback - Richard On Wed, Dec 23, 2009 at 8:34 PM, Eric Zhong ericiszhongwen...@gmail.comwrote: 2009/12/24 Eric Zhong ericiszhongwen...@gmail.com when i use for-loop to access elements with array index or get() method it doesn't

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

2009-12-23 Thread Eric Zhong
2009/12/24 Richard D. Worth rdwo...@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 ericiszhongwen...@gmail.comwrote: 2009/12/24 Eric Zhong ericiszhongwen...@gmail.com when i use for-loop to access

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

2009-12-23 Thread Richard D. Worth
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 ericiszhongwen...@gmail.comwrote: 2009/12/24 Richard D. Worth rdwo...@gmail.com What about using .each? http://docs.jquery.com/Core/each#callback

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

2009-12-23 Thread Eric Zhong
thanks again, i think i have understand your mind. Thanks! 2009/12/24 Richard D. Worth rdwo...@gmail.com 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 ericiszhongwen...@gmail.comwrote:

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

2009-12-23 Thread Šime Vidas
First of all, the wrong code is wrong, look this is your code: $(function(){ var trs = $(#tb tr:not(:first)) for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong

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

2009-12-23 Thread Eric Zhong
thank you very much, your way is better than mine ! 2009/12/24 Šime Vidas sime.vi...@gmail.com First of all, the wrong code is wrong, look this is your code: $(function(){ var trs = $(#tb tr:not(:first)) for( var i=0; i$trs.length; i++ ) {

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

2009-12-23 Thread Rick Faircloth
Ø this is a pretty stupid way to loop through a jQuery object Is it necessary to be insulting to be helpful, Eric? What was your code like when you first began to write JS or jQuery? Always perfect and mature, I’m sure… Rick From: jquery-en@googlegroups.com

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

2009-12-23 Thread MorningZ
On Dec 23, 10:01 pm, Rick Faircloth r...@whitestonemedia.com wrote: Ø  this is a pretty stupid way to loop through a jQuery object Is it necessary to be insulting to be helpful, Eric?  What was your code like when you first began to write JS or jQuery?  Always perfect and mature, I’m sure…

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

2009-12-23 Thread Michael Geary
Don't sweat it, dude. First off, Eric didn't post the comment you're referring to. And if he had, I'd be inclined to cut him some slack. After all, Eric's English is *much* better than my Chinese (or whatever Eric's native language is). Second, we all post something once in a while that offends