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

185
Views
Why do my elements get deleted after changing their innerText?

So on the click of a button, I run some basic maths and change the innerText of some elements, which I know actually refer to the HTML elements. I also don't get any errors what so ever in the console

JS code:

buypaper.addEventListener("click", function() {
        if (pcls >= papercost) {
            earn(-papercost);
            papercost += (papercost / 100) * 30;
            papercost = Math.floor(papercost);
            paper += 1;
            ppc += 20;
            papercounttext.innerText = `you have ${numberWithCommas(paper)} sheets of paper`; // where i suspect the error is happening
            papercosttext.innerText = `price of next sheet of paper: ${numberWithCommas(papercost)} pencils`;
            ppctext.innerText = `you make ${numberWithCommas(ppc)} pencils/click`;
        }
    });

Can anyone help?

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!