0
Good wanted when the user clicks off the input the form was sent, and also that the page does not reload
my php index.
<!DOCTYPE html>
<html>
<head>
<title>Exemplo</title>
<meta charset="utf-8">
</head>
<body>
<div id="formulario">
<button onclick="carregaFormulario()">Gera formulario</button>
</div>
<script type="text/javascript">
function carregaFormulario() {
let divConteudo = document.getElementById('formulario')
let formulario = document.createElement('form')
let input = document.createElement('input')
input.name = 'nome'
formulario.appendChild(input)
formulario.method = 'post'
formulario.action = '#'
input.onblur = () =>{
//submeter o formulario
console.log('Estou aqui')
}
divConteudo.appendChild(formulario)
}
</script>
</body>
</html>
Hello Thor, for the part you wish the page does not reload is worth deepening your knowledge with Ajax or some other framework that implements it.
– RXSD