a click function code example
Example 1: on click jqueyr
//Click for event to trigger
$( "#target" ).click(function() {
alert( "Handler for .click() called." );
});
Example 2: set onclick jquery
$(elem).click(myFunc());
Example 3: 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);
}
}
Example 4: javascript perform click
eventFire(document.getElementById('mytest1'), 'click');