JSFiddle - React, Tailwind, and code Playground

by tea4two

HTML

<input type="text" id="ipt1" />

CSS

#ipt1 {
    border: 1px solid #ccc;
    height: 30px;
}
#ipt1.focused {
    border-color: #000;
    background-color: lightyellow;
}

JavaScript

$('#ipt1').focus(function() {
    $(this).addClass('focused');
}).blur(function() {
    $(this).removeClass('focused');
});