JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<title></title>
<body>
<table border="1px">
<tr>
<td><span>1</span></td>
<td><span>2</span></td>
<td><span>3</span></td>
<td><span>4</span></td>
<td><span>5</span></td>
<td><span>6</span></td>
</tr>
</table>
<button id="button">Start/Stop</button>
</body>
JavaScript
$("#button").click(function(){
for (var i = $("span").length; i > 0; i--) {
setTimeout(function(){
$("span:nth-child("+i+")").css("background-color","blue");
}, 2000);
}
});