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

231
Views
How do I change an element's text through JavaScript?
<section id="section1" data-nav="Section 1" class="your-active-class">
      <div class="landing__container">
        <h2>Section 1</h2>
        <p>Lorem ipsum dolor sit amet</p>
        <p>Aliquam a convallis justo.</p>
      </div>
    </section>

I have tried textContent and innerHTML, I tried to get element by ID, class and tag but nothing is working. I am pretty sure I am missing something. How could I change the paragraphs inside the headings, and the headings themselves as well?

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

0

Try this code, paste your paragraph's id attribute inside the getElementById thing.

var paragraph = document.getElementById("id-of-your-paragraph");

paragraph.innerHTML = "Hello its a new text!";
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!