javascript detect a click code example
Example 1: how to detect a button click in javascript
if(document.getElementById('button').clicked == true)
{
alert("button was clicked");
}
Example 2: javascript perform click
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}