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

137
Views
How to get full html source from jsdom

I am using JSDOM to modify html text using jquery. After I modify it with jquery, i need the full html. I tried the code below, but it wob't give <!Doctype html> and all. How to get the full html?

mycode

import jquery from "jquery";
import { JSDOM } from "jsdom";

function addElement(html){
      const { window } = new JSDOM(html);
      const $ = jquery(window);
      $("body").html("Hello SO!")
      return $("html").html()

}

Thanks in advance

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

May be this will help

` <!DOCTYPE html>
<html lang="en">
    <head> ${document.head.getInnerHTML()} </head> 
    <body> ${document.body.getInnerHTML()} </body> 
</html> `
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!