Using eq() and find() to add a class

biscanin

New Member
I have a few divs within a containing div, eg:\[code\]<div id="container"> <div class="itmeholder"> <div class="item"> </div> </div> <div class="itmeholder"> <div class="item"> </div> </div> <div class="itmeholder"> <div class="item"> </div> </div> <div class="itmeholder"> <div class="item"> </div> </div></div>\[/code\]I want to add a class to the 2nd 'item' div, so I created:\[code\]$('#container:eq(1)').find('.item').addClass('newclass');\[/code\]This isnt working. I have also tried using \[code\]nth-child()\[/code\] as well, also to no avail.Can anyone suggest to me a better way of going about this?
 
Back
Top