JSFiddle - React, Tailwind, and code Playground
by prozoroff
HTML
<div id = "cccc">123</div>
JavaScript
function addEvent(elm, evType, useCapture) {
attachAlert = function(){
alert('attachAlert');
}
addAlert = function(){
alert('addAlert');
}
if (elm.addEventListener) {
elm.addEventListener(evType, addAlert, useCapture); //DOM2.0
return true;
} else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, attachAlert); //IE5+
return r;
} else {
elm['on' + evType] = fn; //DOM 0
}
}
var ccc = document.getElementById('cccc');
addEvent(ccc,'click',false);