JSFiddle - React, Tailwind, and code Playground
HTML
<button id="b1">Click me</button>
<button id="b2" class="disabled">Click me (disabled)</button>
JavaScript
var onclick = function() {
alert('I’m '+this.id);
}
document.getElementById('b1').onclick = onclick;
document.getElementById('b2').onclick = onclick;
document.addEventListener('click', function(e) {
if ( e.target.className == 'disabled' ) {
e.stopPropagation();
alert('I’m disabled');
}
}, true);