Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda