JSFiddle - React, Tailwind, and code Playground

HTML

<div>Div</div>
<input type="text" />

CSS

body { margin: 30px; }

JavaScript

$('input').on("focus", function() {
    
    $('input').one("keyup", function() {
        
        var val = $(this).attr('value'),
            previous = $(this).prev();
        
        if ( val === '' ) {
            previous.show();
            console.log('Empty');
        }
        else if ( val !== '' ) {
            previous.hide();
            console.log('Text');
        }
        
    });
    
});