,
--Karl
_
Karl Swedbergwww.englishrules.comwww.learningjquery.com
On Oct 1, 2007, at 6:24 PM, Adam Stacoviak wrote:
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
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
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
3 matches
Mail list logo