Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript simulate click on element

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');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #simulate #click #element
ADD COMMENT
Topic
Name
2+2 =