JSFiddle - React, Tailwind, and code Playground

HTML

<div id="option1">One</div>
<div id="option2">Two</div>
<div id="option3">Three</div>

CSS

div {
    border: 1px solid black;
    width: 150px;
    height: 20px;
    padding: 5px;
    text-align: center;
}

.green {
    background-color: green;    
}

JavaScript

(function() {
    var options = [$("#option1"), $("#option2"), $("#option3")],
        cycles = 5,
        i = 0,
        $last = $(null);

    (function next() { 
        if(i < cycles * options.length) {
            $last.removeClass("green");
            $last = options[i % options.length].addClass("green");
            i++;
            setTimeout(next, 1200);
        } else {
            $last.removeClass("green");
            alert("finished!"); //do any other "we're done" stuff here.
        }
    }());
}());