JSFiddle - React, Tailwind, and code Playground
HTML
Name: <textarea id="myText" value=""></textarea>
<button type="button" onclick="myFunction()">Enviar</button>
<div id="demo"></div>
CSS
p{
background-color: red;
font-family: arial;
}
#demo
{
display:none;
background:#333;
color:#ddd;
padding:5px;
}
JavaScript
function myFunction() {
var x = document.getElementById("myText");
var defaultVal = x.defaultValue;
var textoComentario = x.value;
alert(textoComentario);
if (defaultVal == textoComentario) {
alert("Digite um comentário!");
} else {
$("#demo").css("display","block");
$("#demo").append("<p>" + textoComentario + "</p>");
x.value = "";
}
}