JSFiddle - React, Tailwind, and code Playground

HTML

<form action="some-file.php" method="post">
    <label for="comment">Enter a comment, beotch:</label>
    <input type="text" id="comment" name="comment"/>
    <span id="error">Where's the comment, fool?</span>
    <button type="submit">Submit</button>
</form>

CSS

#error {
    display: none;
    color: #f00;
}

JavaScript

window.onload = function () {

    var checkHasValue = function () {
        var checkBox = document.getElementById("comment");

        if (checkBox.value) return true;

        document.getElementById("error").style.display = "inline";
        checkBox.style.border = "1px solid #f00";

        return false;
    };

    document.forms[0].onsubmit = checkHasValue;
};