Create the CSS style class named "invalid", whose formatting is as follows: # A00 and white text. Change form validation so that if a form field is invalid, assume this class. If it is correct, go back to the default style
<div>
<label for="txtNome">Nome:</label>
</div>
<div>
<input type="text" id="txtNome" name="txtNome" size="50" maxlength="100">
<p class="aviso" id="avisoTxtNome" style="display:none;">Este campo não pode ficar vazio!</p>
</div>
if (document.getElementById("txtNome").value.length < 3) {
alert('Por favor, preencha o campo nome');
document.getElementById("txtNome").focus();
return false
}
That is, change the alert to what is in html, but using these methods.