JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="subEmail" onchange="checkFilled();"/>
JavaScript
function checkFilled() {
var inputVal = document.getElementById("subEmail");
if (inputVal.value == "") {
inputVal.style.backgroundColor = "yellow";
}
else{
inputVal.style.backgroundColor = "";
}
}
checkFilled();