JSFiddle - React, Tailwind, and code Playground

HTML

<div id="otherDisv">OTHER Div...</div>
<input type="textbox" id="textBoxId">
<div id="divId">RESULT....</div>
<div id="otherDiv">ANOTHER Div...</div>

JavaScript

var keepFocus = false;
function hideList(){
    if(!keepFocus){
        $('#divId').hide();
    }
}

$('#textBoxId').blur(function() {
    keepFocus = false;
    window.setTimeout(hideList, 100);
}).focus(function(){
    keepFocus = true;
});


$('#divId').blur(function() {
    keepFocus = false;
    window.setTimeout(hideList, 100);
}).click(function(){
    keepFocus = true;
});