JSFiddle - React, Tailwind, and code Playground
HTML
<!-- try to change the value="" -->
<input class="test" type="text" value="">
CSS
.removeMe {
color:red;
}
.addMe {
color: #0f0;
}
JavaScript
$(function () {
if (!$(".test").val()) {
alert("Empty");
$(".test").addClass("removeMe");
} else {
alert("not Empty");
$(".test").addClass("addMe");
}
});