JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text">
CSS
input {
background: white;
transition: background-color 0.2s ease;
}
input.flash {
background-color: red;
}
JavaScript
var input = $('input');
input.on('input', function(){
if (!$.trim(input.val())) {
input.addClass('flash');
setTimeout(function(){
input.removeClass('flash');
}, 200);
}
});