NeXT5tep NeXT5tep - 29 days ago 7
Javascript Question

How do I emulate a click on a div then fire the onclick event in webview programatically?

I am new to JavaScript,just created a cocoa app with a webView embedded which display the gmail iPhone site.What i want to do here is to schedule a timer method, then in the timer method,emulate a click on a refresh button to fire the on click event?
Please help.

enter image description here

Answer

Dom events can be fired just calling it:

The code below will fire the click event of the element with the id '#foo'

document.getElementByTagName('foo').onclick();