JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text"/><br/>
<input type="text"/><br/>
<input type="text"/><br/>
<input type="text"/><br/>
<input type="text"/><br/>

CSS

input.empty {
    background-color: rgba(255,0,0,.1)
}

JavaScript

$('input').on('keyup',function(e){
    console.log(e,this);
    if ($(this).val() == "") $(this).addClass('empty');
    else $(this).removeClass('empty');
})
$('input').keyup();