I have created a checkbox dynamically. I have used addEventListener to call a function on click of the checkbox, which works in Google Chrome and Firefox but <
addEventListener
if (document.addEventListener) { document.addEventListener("click", attachEvent, false); } else { document.attachEvent("onclick", attachEvent); } function attachEvent(ev) { var target = ev.target || ev.srcElement; // custom code }