jquery, TypeError: $(selector) is null, problem?
<p>i have a web page that redirects to another page on click.
on the second page i have this:</p>

<pre><code>&lt;?php if(isset($_POST['tab1'])) { ?&gt;
  &lt;script&gt;$('#home').trigger('click'); &lt;/script&gt; 
&lt;?php }?&gt;    
</code></pre>

<p>the <code>$_POST</code> comes back ok, only i get this error in the console for the jquery:</p>

<p>in firebug:</p>

<pre><code>TypeError: $("#home") is null
</code></pre>

<p>or in Chrome:</p>

<pre><code>$('#home').trigger('click');
</code></pre>

<p>if i run this: <code>alert(document.getElementsByTagName('#home'));</code></p>

<p>i get a alert with: <code>[object HTMLCollection]</code> as <code>undefined</code></p>

<p>if i view the source i can see my jquery there:</p>

<pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"&gt;&lt;/script&gt;
&lt;script&gt;
!window.jQuery &amp;&amp; document.write('&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"&gt;&lt;\/script&gt;');
&lt;/script&gt;
</code></pre>

<p>any ideas on why the jquery fails?</p>

<p>thanks</p>
