JSFiddle - React, Tailwind, and code Playground
HTML
<p><button id="btn1">Click me</button></p>
<p><button id="btn2">Click me as well</button></p>
JavaScript
function clickHandler(e) {
alert(e);
}
window.onload = function() {
document.getElementById('btn1').onclick = clickHandler;
document.getElementById('btn2').onclick = function(e) {
clickHandler(e);
}
}