JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="inputID">

<div class="box">I will hide on out focus of textbox</div>
<div id="someDIVid">If clicked, above will not hide</div>
<button>test again</button>

JavaScript

$(function() {
    var flag = false;
    $('#inputID').blur(function() {
        $('div.box').toggle(flag);
    });

    $('#someDIVid').click(function() {
        flag = true;
    });
    
    
    $('button').click(function(){
        $('div.box').show();
        flag = false;
    });
})