JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<button style="padding: 3em;" id="my-button">Button</button>
<span>Handler fired: <span id="num-times">0</span> times</span>
</div>
JavaScript
var numTimes = 0;
function testHandler() {
console.log("Handler fired");
numTimes++;
document.getElementById("num-times").innerHTML = numTimes;
}
document.getElementById("my-button").addEventListener("click", testHandler);