JSFiddle - React, Tailwind, and code Playground

HTML

<div id="hideMsg">
The entry you posted not valid.
This Box will Close In <span>10</span> Seconds
</div>

JavaScript

var sec = $('#hideMsg span').text()
var timer = setInterval(function() { 
   $('#hideMsg span').text(--sec);
   if (sec == 0) {
      $('#hideMsg').fadeOut('fast');
      clearInterval(timer);
   } 
}, 1000);