Hi,

I have an element like this: <a id="a1" href="javascript:doSomething
();">#a1</a>
However, when I do this: $('#a1').click(); ... then my doSomething()
do not get called. Why?

If I make my own click function, like this:
function clickAt(targetElement) {
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent("click", "true", "true");
        return targetElement.dispatchEvent(evt);
}

... and call it this way: clickAt($('#a1')[0]); ... then my doSomething
() do get called.

If you like, you can try it out here: <http://folk.uio.no/jkleiser/
test/jq-test.html>

/Jon

Reply via email to