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

296
Views
Why will this function run only once on click but after that it stops working

Why will this function work only once? I'm expecting it to keep adding values to the page, but it only does the conversion one time and after that it stops reacting to button clicks:

let myButton = document.querySelector('#convert');
myButton.addEventListener('click', function() {
  let finalResult = converter(document.querySelector('#myInput').value);
  document.body.innerHTML += finalResult;
})

function converter(value) {
  let conversionResult = (value - 32) / 1.8;
  return conversionResult;
}
<input type="number" id="myInput">
<button id="convert">Convert</button>

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!