JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="test"></textarea>
CSS
#test { border-color: red; }
#test:focus { border-color: green !important; outline: none; }
JavaScript
document.getElementById("test").addEventListener("keydown", controlBorderColor, false);
document.getElementById("test").addEventListener("keyup", controlBorderColor, false);
function controlBorderColor() {
if (this.value.length == 0) { this.style.borderColor = "red"; $.now();}
else { this.style.borderColor = "blue"; }
}