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
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 answers
Answer question

0

Does something like this work for you:

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