JSFiddle - React, Tailwind, and code Playground

by Rishabh Sharma

HTML

<button id="button">Click Me!</button>

</div>

JavaScript

HTMLElement.prototype.on = function(action, fn) {
	const handler = function(e) {
  	fn(e);
  }
  this.addEventListener(action, handler);
}

document.querySelector('#button').on('click', (e) => {
	console.log(e);
})