How can I trigger a link-click with jQuery
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/773639/how-can-i-simulate-an-anchor-click-via-jquery">How can I simulate an anchor click via jquery?</a><br>
  <a href="http://stackoverflow.com/questions/1421584/how-can-i-simulate-a-click-to-an-anchor-tag">How can I simulate a click to an anchor tag?</a>  </p>
</blockquote>



<p>I have following code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function () {
        $('#g').trigger('click');
        //$('#g').click();
        // also tried this, it won't work
    });
&lt;/script&gt;
&lt;a href="http://google.at" id="g"&gt;google&lt;/a&gt;
</code></pre>

<p>Example <a href="http://jsfiddle.net/AZ35C/" rel="nofollow">here</a></p>

<p>What I'm trying to do is quite simple: just follow the link ...
But it won't work ...</p>

<p>I know the workaround, where I set <code>window.location = $('#g').attr('href')</code> ... obviously that's not the the pretty-version ...</p>

<p>So how can I achieve the wanted behaviour?</p>

<p>Thanks in advance!</p>
