JSFiddle - React, Tailwind, and code Playground
by Andrew Gerst
HTML
<div id="textContainer">This is a simple text in the container.</div>
<button onclick="GetTextNode()">Get the contents of the container</button>
JavaScript
function GetTextNode(){
var textContainer = document.getElementById("textContainer");
var textNode = textContainer.firstChild;
alert(textNode.data);
}