<div id="txt">
   Siply text <b>bold tex</b> and <i>italics</i> End text.
  <p>New paragraph dot.</p>
  </div>

<button onclick="showTextContent()">Show text content</button>

function showTextContent() {
  var element = document.getElementById("txt");
  var txt = element.textContent;
  
  console.log(txt);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.