JSFiddle - React, Tailwind, and code Playground
HTML
<span>10</span>
<span>50</span>
<span>5</span>
<span>100</span>
JavaScript
$(function() {
function count($this){
var current = parseInt($this.html(), 10);
$this.html(++current);
if(current !== $this.data('count')){
setTimeout(function(){count($this)}, 50);
}
}
$("span").each(function() {
$(this).data('count', parseInt($(this).html(), 10));
$(this).html('0');
count($(this));
});
});