Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
Extract input value html and js

Im trying to extract the values of my inputs. Im using this inputs in a JavaScript. Im using the onclick event on an input type button called thebutton and I want to extract the values in a function called data. The inputs are print in a div called formulary and I want to print the input values in a div called results. When I run it, the three values are print as undefined. So this is my current code:

<script>
 document.getElementById("fomulary").innerHTML+="<br>Data:<br><br>  <form><input id='name' type='text' placeholder='Name'<br><br><input id='address' type='text' placeholder='Address'<br> <br> <input id='tel' type='tel' placeholder='Phone number'><br> <input onclick='data()' type='button' id='thebutton' value='Send'></button> </form>";
     
      var name=document.getElementById("name").value;
      var address=document.getElementById("address").value;
      var tel=document.getElementById("tel").value;
    

function data(name, address, tel){

      document.getElementById("results").innerHTML=name+" "+address+" "+tel;
      
    }
  
<script>

Thank you.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda