JSFiddle - React, Tailwind, and code Playground

by Dark Hole

HTML

<div>Text... <button>Ok</button></div>
<span class="log"></span>

JavaScript

window.onerror = alert;

// Don't forget, this code is onload!
var el  = document.getElementsByTagName('div')[0];
var log = document.getElementsByClassName('log')[0];

log.textContent = getText(el);

function getText(el) {
	var curel = el.firstChild;
  var endel = el.lastChild;
  var text = '';
  for(;curel != endel; curel = curel.nextSibling) if(curel.nodeType == 3) text += curel.nodeValue;
  return text;
}