JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" id="gogogo">Go!</button>
<div id="progress">0</div>
JavaScript
var progress = document.getElementById('progress');
var restoreCursor= function () {
document.body.style.cursor = 'default';
};
document.getElementById('gogogo').onclick = (function(){
document.body.style.cursor = 'wait';
var ii = 0;
// this is a immediately executed function
//that calls itself with a small timeout
(function goLoop(){
progress.textContent = ii;
if(ii<100){
ii++;
setTimeout(goLoop,10);
}else {
restoreCursor();
}
})();
});