Skip to content Skip to sidebar Skip to footer

How Do I Retrieve All Text In An HTML DOM But Exclude SCRIPT And STYLE Tags?

I know how to quickly extract text nodes from a DOM: document.evaluate('//text()', document, null, XPathResult.ANY_TYPE, null) But is there an easy way to exclude text from SCRIPT

Solution 1:

//*[not(self::script or self::style)]/text()

Post a Comment for "How Do I Retrieve All Text In An HTML DOM But Exclude SCRIPT And STYLE Tags?"