[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

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

2009-12-23 Thread Michael Geary
Wednesday, December 23, 2009 9:52 PM > *To:* jquery-en@googlegroups.com > *Subject:* Re: [jQuery] Re: how to access elements with index in for-loop > > > > thank you very much, your way is better than mine ! > > 2009/12/24 Šime Vidas > > > First of all, the "

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

2009-12-23 Thread MorningZ
On Dec 23, 10:01 pm, "Rick Faircloth" 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… > > Rick The

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

2009-12-23 Thread Rick Faircloth
...@googlegroups.com] On Behalf Of Eric Zhong Sent: Wednesday, December 23, 2009 9:52 PM To: jquery-en@googlegroups.com Subject: Re: [jQuery] Re: how to access elements with index in for-loop thank you very much, your way is better than mine ! 2009/12/24 Šime Vidas First of all, the "wrong&quo

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 > > 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

[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 $trs.get(i).find("td:eq(1)").a

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 > 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 > wrote: > >> >> >> 2009/12/24 Richard D. Worth >

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 wrote: > > > 2009/12/24 Richard D. Worth > > What about using .each? >> >> http://docs.jquery.com/Core/each#callback >> >> - Richard >> >> >> On Wed, De

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

2009-12-23 Thread Eric Zhong
2009/12/24 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 > wrote: > >> >> >> 2009/12/24 Eric Zhong >> >> when i use for-loop to access elements with array index or get() method it >>> does

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 wrote: > > > 2009/12/24 Eric Zhong > > 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,

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

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