views:

32

answers:

1

How can I click in a image/function with javascript?

Something like:

document.getElementById("check-in-banner").click();

the source of the part is

<a id="check-in-button" href="#">

Thank you very much

+2  A: 
var el = document.getElementById("check-in-button");
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
el.dispatchEvent(evt);
jay_soo