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

130
Views
sumando dos campos de entrada juntos

He estado tratando de agregar dos valores de dos campos de entrada junto con una función js simple. No funciona, por favor ayuda.

 <input class = "field1" type="text"> <input class = "field2" type="text"> <p class = "field3"></p> <button onclick = "calculate()">Calculate</button> <script> function calculate(){ let ipt1 = document.getElementsByClassName("field1").value; let ipt2 = document.getElementsByClassName("field2").value; let results = document.getElementsByClassName("field3"); let total = Number(ipt1 + ipt2); return results.innerHTML = total; } </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<input class = "field1" type="text"> <input class = "field2" type="text"> <p class = "field3"></p> <button onclick = "calculate()">Calculate</button> <script> function calculate(){ let ipt1 = document.getElementsByClassName("field1")[0].value let ipt2 = document.getElementsByClassName("field2")[0].value let results = document.getElementsByClassName("field3")[0] let total = Number(ipt1) + Number(ipt2) return results.innerHTML = total; } </script>
about 4 years ago · Juan Pablo Isaza Report
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!