JSFiddle - React, Tailwind, and code Playground
HTML
<div id="TheSafeZone" class="zone">
<p>The Safe Zone</p>
<input type="text" />
<br/>
<input type="text" />
<br/>
<input type="text" />
</div>
<div id="TheDangerZone" class="zone">
<p>The Danger Zone</p>
<input type="text" />
<br/>
<input type="text" />
<br/>
<input type="text" />
</div>
CSS
.zone{
display:inline-block;
padding:10px;
margin:10px;
}
#TheSafeZone {
background-color:#AEA;
border:2px solid #0A0;
}
#TheDangerZone {
background-color:#EAA;
border:2px solid #A00;
}
JavaScript
var timeoutID;
$("#TheSafeZone input").focus(function () {
if (timeoutID) {
clearTimeout(timeoutID);
timeoutID = null;
}
});
$("#TheSafeZone input").blur(function () {
releaseTheHounds();
});
function releaseTheHounds() {
timeoutID = setTimeout(function () {
alert("You're all going to die down here");
}, 1);
}