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

146
Vistas
Get all content as string inside div

I need to get all content inside an HTML element, including all child nodes and grandchild nodes and their content as if it was a string. This is my expected output:

<div class="images"><div class="img_100"><a class="img a" legenda="" target="" style=""><img src="/img/site/570/b/random_image.jpg" alt="Lorem ipsum - dolor sit amet" class="portrait"></a></div></div>

I am currently using JS with puppeteer to scrape the page I need, but I need all the HTML as string to format some content and I don't know how to get this the way I want.

I also used this query document.querySelectorAll(".page_content_post") to get the parent element I want the content and child/grandchild nodes from.

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

to get parent by class:

document.getElementsByClassName('.page_content_post').innerHTML

to get parent by ID:

document.getElementById('#page_content_post').innerHTML
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