[jQuery] Re: Need access to index within loop

2009-01-22 Thread brian
You're passing the string "i". Remember that the selector is just a string passed to the jQuery object. Try this: $('li:eq('+i+')').fadeIn('slow'); On Thu, Jan 22, 2009 at 5:41 AM, elduderino wrote: > > > HI, > > I have this code: > > $(document).ready(function(){ > > $('li').each(functi

[jQuery] Re: Need access to index within loop

2009-01-22 Thread Karl Rudd
You don't have to "select" the LI again. Within the "each" function the "this" variable refers to the LI DOM node. So you can write: $(document).ready(function(){ $('li').each(function(i) { alert(i); $(this).fadeIn('slow'); }); }); Karl Rudd On Thu, Jan 22, 2009 at 9:41 PM, elduderi

[jQuery] Re: Need access to index within loop

2009-01-22 Thread brian
Oh--I missed that entirely. Yes, what Karl said! On Thu, Jan 22, 2009 at 5:43 PM, Karl Rudd wrote: > > You don't have to "select" the LI again. Within the "each" function > the "this" variable refers to the LI DOM node. So you can write: > > $(document).ready(function(){ > $('li').each(function