innertext in javascript mdn code example
Example 1: set text of dom element
document.getElementById("myBtn").textContent = 'Hello World';
Example 2: pull out only text from element javascript
function extractContent(html) {
return (new DOMParser).parseFromString(html, "text/html") .
documentElement . textContent;
}