JSFiddle - React, Tailwind, and code Playground
HTML
<input id="a" value="a" />
<input id="b" value="b" />
<div class="console"></div>
JavaScript
var a = document.getElementById("a");
var b = document.getElementById("b");
function show(elem) {
elem.style.display = 'inline-block';
}
function hide(elem) {
elem.style.display = 'none';
}
a.onfocus = function() {
console.log('focus a fired');
show(b);
};
var hideB = function(){
console.log(this.id, ': blur fired');
hide(b);
};
a.onblur = hideB;
b.onblur = hideB;
b.onfocus = function(){
console.log('focus b fired');
show(b);
};