jQuery trigger an element's event
<p>My question is same as this <a href="http://stackoverflow.com/questions/7999806/jquery-how-to-trigger-click-event-on-href-element">one</a></p>

<p>I also faced the same problem which is <code>href</code> not triggered for event 'clicked'
.Then I changed to <code>alt</code> and element is <code>span</code> . Here is my code  </p>

<pre><code>&lt;li&gt;&lt;h2&gt;&lt;span id='aa' alt="#inbox"&gt;&lt;span&gt;Inbox&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;/li&gt;  
</code></pre>

<p>This line is my 2nd child of  <code>ul</code> . I want to trigger/click this  line when the page is loaded. </p>

<p>But I want to know how to trigger this span's(#aa) click event.Following codes are tried.but not worked.<br>
first try:</p>

<pre><code>var href = $('#aa').attr('alt');
      window.location.href =href; // this gave me 404 error   
</code></pre>

<p>2nd try:</p>

<pre><code> $('#aa').trigger("click")   // this has no change
</code></pre>

<p><strong>Edit</strong> a function will be executed when the above mentioned li>span is clicked. I want that li's span be clicked automatically when the page has loaded. <a href="http://stackoverflow.com/questions/7999806/jquery-how-to-trigger-click-event-on-href-element">this question</a> 's answers say some problems when <code>&lt;a href&gt;</code> is used.Therefore, I used <code>span</code> tag instead.  I use jQuery 1.6 </p>
