When you write $('dl.set:first') you are saying, "make a list of all DL elements in the document that have the 'set' class, and give me the first element in that list."
Putting this code inside the .each() loop doesn't change that. The $('dl.set:first') selector stands on its own. The code you want is: $('.set_list').each( function() { $(this).find('dl.set:first').addClass('first'); }); By writing $(this).find('dl.set:first') you are saying, "Start with 'this', which is the '.set_list' element for this particular iteration of the .each() loop. Now find the DL elements with the 'set' class *inside* this '.set_list'. Give me the first of those elements." I'm assuming that the .set_list element actually is the parent of those DL/DT/DD elements. -Mike On Thu, Oct 1, 2009 at 8:19 AM, Dave Maharaj :: WidePixels.com < d...@widepixels.com> wrote: > I am trying to add a class to the first <dl> item each time it appears > inside set_list > > $('.set_list').each(function(){ > $('dl.set:first').addClass('first'); > }); > > This appers to only add 'first' to the first dl and not each one in each > set_list > > I have my code like below..i simply want to add 'first' to the first dl in > each set_list > > set_list > dl <= i want first added here > dt > dd > > dl > dt > dd > > set_list > dl <= i want first added here > dt > dd > > dl > dt > dd > > Know where i went wrong? > > Dave >