JSFiddle - React, Tailwind, and code Playground
HTML
<form action="send.php" id="myform" method="post">
<label>Your name:</label>
<input type="text" name="username" placeholder="Type your name" id="username" class="required" />
<label>Your email:</label>
<input type="text" name="email" placeholder="Type your email address" id="email" class="required" />
<label>Subject / Title:</label>
<input type="text" name="subject" placeholder="Title / Subject" class="required" />
<label>Write us something:</label>
<textarea col="99" placeholder="Describe as detailed as possible, what you want us to do, for you. Send what you want and we will reply to you, as soon as possible!" id="message"></textarea>
<input onclick="return validateForm();" type="submit" name="submit" value="Enviar" id="submit" />
</form>
<div class="alert alert-warning hidden" id="warning">An error has occured! Please fill your email and message!</div>
<div class="alert alert-success hidden" id="success">Message sent! We will reply to you, as soon as possible!</div>
JavaScript
function validateForm() {
if ($("#message").val() == "") {
$("#warning").removeClass("hidden");
$("#warning").addClass("show");
$('#warning').delay(5000).fadeOut(500);
return false;
} else {
$("#sucess").removeClass("hidden");
$("#success").addClass("show");
$('#sucess').delay(5000).fadeOut(500);
return true;
}
}