JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text">
<button>Press me!</button>

JavaScript

$(function () {
    
    var focusEle;
    
    $('*').focus(function () {
        focusEle = this;
    });
    
    $('button').click(function (e) {
        console.log(focusEle);
        var c = confirm('Love the cat :3?');
        $(focusEle).focus();
    });
});