1
This is my code is a simple form:
<!DOCTYPE html>
<html>
<head>
<title>Formulário</title>
<meta charset="utf-8" />
</head>
<body>
<form name="meu_form">
<h1>Formulário</h1>
<p class="nome">
<label for="nome">Nome</label>
<input type="text" id="nomeid" required="required" name="nome" />
</p>
<p class="fone">
<label for="fone">Fone</label>
<input type="text" id="foneid" name="fone" />
</p>
<p>
<label for="email">Email</label>
<input type="email" id="emailid" name="email" />
</p>
<p class="submit">
<input type="submit" onclick="enviar()" value="Enviar" />
</p>
</form>
<script type="text/javascript">
function enviar() {
var nome = document.getElementById("nomeid");
var fone = document.getElementById("foneid");
var email = document.getElementById("emailid");
if (nome.value != "") {
console.log('Obrigado sr(a) ' + nome.value +
' os seus dados foram encaminhados com sucesso.\n'
+'Seus dados:\n'
+'Nome : '+ nome.value
+'\nFone '+ fone.value
+'\nEmail '+ email.value);
}
}
</script>
</body>
</html>
If I replace the console with Alert works, but I want to use the console.
The problem is that when I want to view the output in the browser console Chrome (not tested on others) it is displayed so fast that not time read.
What should I do?
why don’t you sweat the Alert?
– Bsalvo
You are using which browser?
– Bsalvo