Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda