JSFiddle - React, Tailwind, and code Playground

HTML

<button id="popupBoxAccept">ACCEPT</button>

JavaScript

var tim = setTimeout(function(){
    $('#popupBoxAccept').click();
},5000); // 5" for the demo


$('#popupBoxAccept').click(function(){
     clearTimeout(tim);
      // ........
     alert('ola')
});