JSFiddle - React, Tailwind, and code Playground

by Roman Zhak

HTML

<input id="ctx" />
<div></div>

JavaScript

var $el = document.getElementById("ctx");

  if( "oninput" in $el ) {
     // native oninput 
     $el.addEventListener("input", function(e) {
      // skip nodeType === 3
      this.nextSibling.nextSibling.textContent = this.value;
     }, false);
  } else {
    // trying to polyfill   
    $el.addEventListener("keyup", function(e) {
     this.nextSibling.nextSibling.textContent = this.value;
    }, false);
  }