Trigger the javascript function of the anchor's href during document.ready
<p>Is it possible to trigger the javascript function of an anchor tag during page load?</p>

<p>Here is my <a href="http://jsfiddle.net/jansian/yCvBH/" rel="nofollow">fiddle</a></p>

<pre><code>&lt;a  id="WebTree" href="javascript:alert('testing')"&gt;click me&lt;/a&gt;


$(document).ready(function(){
    $('#WebTree').trigger('click');
    //$('#WebTree').click();
    // after the page load I'm expecting to see the alert but it's not working
});
</code></pre>

<p>I'm expecting to see an alert after the page is loaded but I'm not</p>

<p><strong>EDIT</strong></p>

<p>Ok here's simple explanation why I'm asking this question.</p>

<p>Here is the original link which was dynamically generated by sharepoint.</p>

<pre><code>&lt;A id=ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeViewn1 href="javascript:TreeView_PopulateNode(ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeView_Data,1,ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeViewn1,ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeViewt1,ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeViewt1i,' ','TaxonomyMetadata','Pages\\TaxonomyMetadata','t','30:FieldNameNode:e305128c-217b-47b4-81b9-db0c1e59f98f:3b529925-3610-485a-9133-bc958f7ab28e:dbf365da-565b-41ca-966d-f9bf29d9b2cf:30|ListNode|e305128c-217b-47b4-81b9-db0c1e59f98f|3b529925-3610-485a-9133-bc958f7ab28e|ea06a686-46c5-4470-a1ab-4fe4341589c8','tt')"&gt;

    &lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" alt="Expand TaxonomyMetadata" src="/_layouts/images/MDNCollapsed.png"&gt;
&lt;/A&gt;
</code></pre>

<p>Bottom line I have no control of the anchor tag. </p>
