JSFiddle - React, Tailwind, and code Playground

by dswitzer

HTML

<textarea id="x"></textarea>
<button id="y" type="button" onclick="document.querySelector('#x').value = 'hey there!';">
  Change it
</button>

JavaScript

var x = document.querySelector("#x");

x.addEventListener('input', function() {
	console.log('[input] The value is now ' + x.value);
});

x.addEventListener('change', function() {
	console.log('[change] The value is now ' + x.value);
});