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, elduderino <jamesfiltn...@gmail.com> wrote: > > > HI, > > I have this code: > > $(document).ready(function(){ > > $('li').each(function(i) { > alert(i); > $('li:eq(i)').fadeIn('slow'); > }); > > }); > > I want to iterate over each li element and fade it in....with a delay for > each one....i'll deal with the delay in a bit but currently the problem is > this bit $('li:eq(i)')....it won't accept the i parameter...it wants a > literal number....how do I do this? > > -- > View this message in context: > http://www.nabble.com/Need-access-to-index-within-loop-tp21601683s27240p21601683.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. >