JSFiddle - React, Tailwind, and code Playground

HTML

<input id="test-input" type="text">

CSS

.yellow {
    background-color: red;
}

JavaScript

$('#test-input').click(function() {
    $(this).addClass('red');
}).blur(function () {
    $(this).removeClass('red');
    
});