JSFiddle - React, Tailwind, and code Playground

HTML

<div id="warning_show">
    <div id="message_box2">
        <h23>Warning!</h23>
        <p>Your account has been Inactive for some time. You will be logged out in <span class="timeout-seconds"></span> seconds.</p>
        <div class="boxclose" id="boxclose">&#10006;</div>
    </div>
</div>

JavaScript

var sec = 3
$('.timeout-seconds').text(sec);
$('#boxclose').click(function() {
    $('#warning_show').hide();
    clearInterval(timer);
});

var timer = setInterval(function () {
    $('.timeout-seconds').text(sec--);
    if (sec == -1) {
        $('#warning_show').fadeOut('fast');
        clearInterval(timer);
        // redirect to login screen...
    }
}, 1000);