HomeToolsAbout

Parsing HTML Content

Parsing HTML Content using Javascript

outerHTML to get HTML of the entire element as a string.

innerHTML to get HTML of the HTML within the given element.

innerText to get the text inside an element (sans HTML markup).

<div id="new-element-1">Hello world.</div> const element = document.getElementById("new-element-1"); const elementOuterHtml: string = element.outerHTML; // <div id="new-element-1">Hello world.</div> const elementInnerHtml: string = element.innerHTML; //
AboutContact