JSFiddle - React, Tailwind, and code Playground

by nosfan1019

HTML

<div id='ppp'>
    <input type='text' id='ooo'/>        
    <div id='kkk'></div>
</div>

<input type="text">

CSS

#kkk {
    width: 100px;
    height: 50px;
    background: #ccc;
    margin: 10px 0 0 2px;
}

#ppp {
    margin: 0 0 10px;
    padding: 50px;
    background: #eee;
}

JavaScript

$('#ooo').focus(function () {
    $('#kkk').text('hello');
    visible = true;
});



$('* :not(#ooo)').focus( function() {
    if (visible) {
        $('#kkk').empty();
        visible = false;
    }
});