JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="subEmail">

JavaScript

function checkFilled() {
	var inputVal = document.getElementById("subEmail");
	if (inputVal.value == "") {
		inputVal.style.backgroundColor = "yellow";
				}
		}
checkFilled();