1setRandomClass();
2setInterval(function () {
3 setRandomClass();
4}, 2000);//number of milliseconds (2000 = 2 seconds)
5
6function setRandomClass() {
7 var ul = $("ul");
8 var items = ul.find("li");
9 var number = items.length;
10 var random = Math.floor((Math.random() * number));
11 items.removeClass("special");
12 items.eq(random).addClass("special");
13}
14