RunKit + npm: cheerio

node v14.20.1
endpointsharetweet
var cheerio = require("cheerio") const $ = cheerio.load('<div class="content">Before first content<strong> This is first content </strong> This is second content<br /><small><p>Something</p></small></div>'); var $outer = $("div.content").contents().filter(function() { return this.nodeType === 3; }); console.log($outer.text()); $outer.each(function() { console.log($(this).text().trim()); });
Created from: https://npm.runkit.com/cheerio
Loading…