JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" value="login" id="submit"/>

<br/>

<textarea id="message" style="color: white; background-color: grey; display: none"  readonly> Default </textarea>

CSS

.success {
    background-color: green;
    color: white;
}

.error {
    background-color: red;
    color: white;
}

JavaScript

$("#submit").click(function() {
    var bool = true;
    
    if (bool) {
        $("#message").fadeIn("slow").removeAttr("style").addClass("success").text("Successful!");
    } else {
        $("#message").fadeIn("slow").removeAttr("style").addClass("error").text("Failed");
    }
});