Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 381 Bytes

parse-html.md

File metadata and controls

14 lines (11 loc) · 381 Bytes

How to parse an HTML page with Node.js

You can use the jsdom npm package:

const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const querySelector = "#outOfStock";
const dom = new JSDOM(html);
dom.window.document.querySelector(querySelector) // an HTML node or null

References: