I figured it out...I just needed to do a bit more reading to my Learning
jQuery book!
var classNames = {
0: 'first',
1: 'second',
2: 'third'
};
$('#section_wrapper_div .section_item').each(function(index) {
$(this).addClass(classNames[index % 3]);
});
On 10/1/07, Adam Stacoviak <[EMAIL PROTECTED]> wrote:
>
> I'm trying to find out how to add a class to every third occurrence of
> an element.
>
> Basically, I have a DIV with an undefined number of DIVs inside of it,
> and I want to add a class to every third DIV.
>
> Thanks!
>
>