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

234
Visualizações
Can I get the raw HTML output from a JS HTML object?

I've created multiple HTML objects using

document.createElement("");

after that, I applied some modifiers like CSS, class names and onclick behaviors. How can I get the raw HTML code that is generated? My solution is creating an invisible div, adding the element as a child and call

document.getElementBy("my-invisible-div").innerHTML

to get the HTML. Is there a better way of doing this? I need it for a database export and I don't want to have my HTML code in a string with placeholders.

Thanks for any advice

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Does something like this work for you:

var element = document.createElement("div")
console.log(element.outerHTML)
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