JSFiddle - React, Tailwind, and code Playground
by calder12
HTML
<form action="" id="myForm">
<div class="formElement">
<label id="nLabel">NOME</label>
<input type="text" name="NOME" id="nome"/>
</div>
<div class="formElement">
<label id="tLabel">TELEFONE</label>
<input type="text" name="telefone" id="telefone" />
</div>
<input type="submit" value="CLICK ME" />
</form>
CSS
label{
font-family:sans-serif;
width:120px;
height:40px;
text-align:center;
color:#FFF;
background-color:blue;
display:table-cell;
vertical-align:middle
}
input[type="text"]{
width:250px;
height:40px;
border:1px solid #CCC;}
.formElement{
display:table;
margin-bottom:5px;
}
input[type="submit"]{
padding:5px 20px;
background-color:#AAA;
color:#FFF;
border:none;
outline:none;
width:120px;
height:40px;
cursor:pointer;
}
input[type="submit"]:hover{
background:black;
}
JavaScript
$("#myForm").submit(function(){
if($("#telefone").val()==''){
$("#tLabel").css("background","#FF0000");
return false;
} else {
$("#tLabel").css("background","blue");
alert($("#telefone").val());
}
});