How can I simulate an anchor click via jquery?

Posted by prinzdezibel on Stack Overflow See other posts from Stack Overflow or by prinzdezibel
Published on 2009-04-21T17:18:12Z Indexed on 2010/04/01 13:13 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

I have a problem with faking an anchor click via jQuery: Why does my thickbox appear the first time I click on the input button, but not the second or third time?

Here is my code:


<input onclick="$('#thickboxId').click();" type="button" value="Click me">

<a id="thickboxId" href="myScript.php" class="thickbox" title="">Link</a>

It does always work when I click directly on the link, but not if I try to activate the thickbox via the input button. This is in FF. For Chrome it seems to work every time. Any hints?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about thickbox