So as my title suggest. For a website I'm building, I need to add a class of 'active' to a list of <li>
on the page.
Sometimes there will be six <li>
, sometimes 17. It needs to be dynamic.
Then I need to add the class to each <li>
in order, one at a time, every 5 seconds.
I was thinking, I could maybe have a counter to count all the <li>
, and have a recurring function that adds the class to the first one and adds to another counter. When that counter hits the original counter for all the <li>
it would stop. But then it would have to occur every 5 seconds.
Any help or advice would be appreciated
-JOPA