try to use this function <script> function test(){ var ind = 0; $('ul').find('li').each(function(){ if (ind == 2){ $(this).css('test_css'); ind = 0; }else{ ind++; } });
} </script> Gk___ Sent from Minsk, Belarus 2009/10/16 huntspointer2009 <huntspoin...@gmail.com>: > > - Can someone please help me solve the following issue? > - How can I select and apply a 'background-color' to the following > <li></li> tags using JQuery? > > <ul class="item_list"> > <li></li> > <li></li> > <li></li><!-- I want to select this one --> > <li></li><!-- I want to select this one --> > <li></li> > <li></li> > <li></li><!-- I want to select this one --> > <li></li><!-- I want to select this one --> > <li></li> > <li></li> > <li></li><!-- I want to select this one --> > <li></li><!-- I want to select this one --> > <li></li> > <li></li> > <li></li><!-- I want to select this one --> > <li></li><!-- I want to select this one --> > <li></li> > <li></li> > </ul> > > > I've tried the following code, but it does NOT work: > var test_css = {'background':'#000'}; > $("ul li:nth-child(3n)").css(test_css); > > > (Thank you, in advance) > >