Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!