Problem with jQuery - error when trying to find 2 tags
<p>I have the following DOM structure:</p>

<pre><code>/*:DOC += &lt;div id='testDiv' class='testDivClass'&gt;&lt;div id='innerTestDiv'&gt;&lt;/div&gt;&lt;/div&gt;&lt;span id='testSpan' class='testSpanClass'&gt;&lt;span id='innerTestSpan'&gt;&lt;/span&gt;&lt;/span&gt;
</code></pre>

<p>Now I tried to run jQuery select against them as follow.  The first one returned alright, but the second one failed:</p>

<pre><code>// works
var result = $('#testDiv')[0];
alert(result.id);

// failed: id is null or not an object
var result2 = $('#testSpan')[0];
alert(result2.id);
</code></pre>

<p>I tried selecting id instead of class and got the same results.</p>

<p>My question is: how can I get the second select to work?  Is there some sort of invisible iterator/pointer in jQuery which I need to reset to the beginning of the DOM before the second select?</p>

<p>Thanks.</p>

<p>EDIT: Ok this is the official "does not work" version. testDiv matched, but testSpan did not, hence I got an error saying id is null or not an object error in the second alert.</p>

<p>UPDATE: I did a test by swapping testDiv and testSpan in the html.  Now BOTH select failed.</p>

<p>UPDATE2: I have changed the html back to what it used to look like. I'm using JsTestDriver to write up the test, but it is actually not calling anything at the moment.  The actual html looks messier than this (more nested tags).  I'm trying to get this simplified version to work first.  It appears that jQuery was able to get into the first select, whether it'll be span or div, but couldnt get out of it to do the second select.  I've replaced jQuery.js and jsTestDriver.jar to no avail.</p>

<p>Thanks.</p>
