I am using cheerio to parse a server side html file using node 6.10.2. I need to get outerHtml of each div inside the body of the document, and my code:
const $ = cheerio.load(data);
let pages = $('body > div').toArray();
console.log(pages[0]);
let htmlPages = pages.map(page => $(page).html());
console.log(htmlPages[0]);
Problem: I get a string with innerHtml. Can someone help pls.
source
share