Hi there,
I have this code which I'm trying to use to apply a class name to each list item.
car $myClass = ["teal", "peach", "salmon", "pink", "blue"];
$('#Navigation ul li').each(function(index){
$(this).addClass($myClass[index]);
})
The problem is that when it reaches the end of the array it stops. How can I keep looping incase there is more than 5 list items?
Thanks
I have this code which I'm trying to use to apply a class name to each list item.
car $myClass = ["teal", "peach", "salmon", "pink", "blue"];
$('#Navigation ul li').each(function(index){
$(this).addClass($myClass[index]);
})
The problem is that when it reaches the end of the array it stops. How can I keep looping incase there is more than 5 list items?
Thanks
Comment