JSFiddle - React, Tailwind, and code Playground

by joshsmith

HTML

<input type="text">

CSS

input {
    background-color: green;
}

JavaScript

$('input').on('keyup', function() {
    var $this = $(this);
    
    if($this.val().length > 0) {
        $this.css({backgroundColor: '#FFF'});
    } else {
        $this.css({backgroundColor: 'green'});
    }
});