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
This is also simple crossbrowser solution:
var addEvent = window.attachEvent||window.addEventListener; var event = window.attachEvent ? 'onclick' : 'click'; addEvent(event, function(){ alert('Hello!') });
Instead of 'click' can be any event of course.