JSFiddle - React, Tailwind, and code Playground

HTML

<div id="counter"></div>

CSS

#counter {
    display: block;
    text-align: center;
    font-size: 25px;
    color: #fff;
    padding: 25px;
    background: red;
    width: 200px;
    line-height: 200px;
}

JavaScript

$(document).ready(function() {
    var n = 99;
    $("#counter").html("Please Wait"); 
    
    // Some long calculation; the red box is showing
    var a = 0;
    for(var i = 0; i < 99999; ++i) {
        for(var j = 0; j < 9999; j++) {
            a++;
        }
    }
    
    var counter = setInterval(function() {
        $("#counter").html(n);
        n--;
        
        if(n <= 0) {
            clearInterval(counter);
        }
        
    }, 1000);
});