JavaScript Error: Microsoft JScript runtime error: Object expected
<p>Below is the "truncated" code for an Ajax TabContainer I'm using for my web page. I need to find the tab index for the container in a JavaScript function, however I continue to get the error message "Microsoft JScript runtime error: Object expected" when this line of code is called in the JavaScript:</p>

<pre><code>        function doValidate() {
            var tabIndex = $('#tabs_header span.ajax_tab_active').index()
</code></pre>

<p>If I comment out the "var tabIndex..." part I do not get the error, so I'm wondering if someone can tell me what is going on here. Below is the code for the tabContainer. I've "truncated" because it is a very large form with over 12 text box inputs. Both tabs represent two different methods of doing a search. By clicking on the "Search" button, the doValidate() method is the first action called, before the site even goes into the code behind. Also, I receive the same error message on the same line of code no matter which tab is active. </p>

<pre><code>    &lt;asp:TabContainer ID="AdvOrBasicSearch" runat="server" ActiveTabIndex="0"&gt;
    &lt;div id="tabs_header"&gt;
        &lt;span id="tab1" class="ajax_tab_active"&gt;
        &lt;asp:TabPanel ID="basicSearch" runat="server" HeaderText="Basic Search"&gt;.../asp:TabPanel&gt;                

        &lt;/span&gt;
        &lt;span id="tab2" class="ajax_tab_active"&gt;
        &lt;asp:TabPanel ID="advSearch" runat="server" HeaderText="Advanced Search"&gt;...&lt;/asp:TabPanel&gt;
        &lt;/span&gt;
    &lt;/div&gt;
    &lt;/asp:TabContainer&gt;
</code></pre>
