js simulando hacer clic
document.getElementById('elementID').click();
Somebody32x2
document.getElementById('elementID').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);
}
}
//usage
eventFire(document.getElementById('mytest1'), 'click');
eventFire(document.getElementById('mytest1'), '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);
}
}
document.getElementById('elementID').click();