0
I need to click the add button and put values inside inputs in the PHP
.
function InserirTelefone(){
$('#telefones').append('<div>Nome: '+$('#nome').val()+' - Telefone: '+$('#telefone').val()+' </div>')
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<body>
<form>
<h2>Inserir Novo Telefone</h2>
Nome: <input id="nome" type="text"/><br>
Telefone: <input id="telefone" type="text"/><br>
<input type="button" onclick="InserirTelefone()" value="Enviar" />
</form>
<div id="telefones">
<h2>Telefones</h2>
</div>
</body>
</html>
Please edit the code to get inside a code block. Anything, just select all and click
ctrl+k
– Jefferson Quesado
Thanks I need to click the add button and put values inside inputs in php
– Boba Fett
But you’re still using Jquery... I need to use pure php
– Boba Fett
you know that PHP is a purely server language, right? So it is not possible to write a front-end event without using Javascript
– Jefferson Quesado