I want to know how I can, instead of sending the result of the pro alert function, create a paragraph, for example. Remembering that this doubt is to help me with future projects, so I am putting a very simple code.
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" lang="pt-br">
<title>Formulário teste</title>
<script type="text/javascript">
function enviar(){
var formulario = document.getElementById('formulario');
var nome2 = formulario.nome.value;
alert(nome2);
}
</script>
</head>
<body>
<h1>Dados para cadastro</h1>
<form id="formulario">
<label for="nome">Nome:</label>
<input id="nom" type="nome" name="nome">
<label for="cpf">CPF:</label>
<input type="cpf" name="cpf">
<label for="cep">CEP</label>
<input type="cep" name="cep">
<button onclick="enviar()">Submit</button>
</form>
<h1 id="receber"></h1>
</body>
</html>