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

194
Views
.innertext doesn't change document

.innerText method changes the text in the h2 element but displays nothing in the p tag. Please what am I not doing correctly?

let increaseCount = document.getElementById("counter")
let saveEl = document.getElementById("save-el")
let click = 0

function increment() {
  click += 1
  increaseCount.innerText = click
}

function save() {
  let countStr = click + " - "
  saveEl.innertext += countStr

  console.log(save)

}
<body>
  <div class="container">
    <h1>People entered</h1>
    <h2 id="counter">0</h2>
    <div class="button">
      <button id="increment-btn" onclick="increment()">INCREMENT</button>
      <button id="save-btn" onclick="save()">SAVE</button>
    </div>
    <p id="save-el">Previous Entries:</p>
    <script src="main.js"></script>
  </div>
</body>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

change innertext to innerText, It is not the same, you must be careful with the capital letters

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!