JSFiddle - React, Tailwind, and code Playground

by nosfan1019

HTML

<div>
    <input type='text'>
    <span></span>
</div>

<div>
    <input type='text'>
    <span></span>
</div>

<div>
    <input type='text'>
    <span></span>
</div>

CSS

div {
    margin: 20px;
    padding: 10px;
}

JavaScript

$(function() {
    $('div input').focus( function() {
        $(this).parent().css('background','#eee');
        $(this).siblings('span').text(' triggered');

        foo = $(this).parent();
    
        foo.focusout(function() {
            $(this).children('span').empty();
            $(this).css('background','white');
            
        });            
        
   });
    
});