JSFiddle - React, Tailwind, and code Playground

by nickxbs

HTML

<textarea></textarea>
<p>event generator</p>

JavaScript

// === just a test ===
var textarea = document.querySelector('textarea'),
    p = document.querySelector('p'),
    evt = new CustomEvent('addLog', {
  				bubbles: true,
  				cancelable: true,
          detail:{msg: "Hey, just a log"}
      });

textarea.addEventListener('addLog', function(evt){
		console.log('pippo',evt.detail.log);
		this.element.textContent=evt.detail.log;
});

document.dispatchEvent(evt);

console.log('t1',  textarea.value === "p says: Hey, just a log");