<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='docs.xsl'?>
<docs>
<method cat='Core' type='Number' short='Searches every matched element for the object and returns
the index of the element, if found, starting with zero.' name='index'>
<desc>Searches every matched element for the object and returns
the index of the element, if found, starting with zero. 
Returns -1 if the object wasn't found.</desc>
<params type='Element' name='subject'>
<desc>Object to search for</desc>
</params>
<examples>
<desc>Returns the index for the element with ID foobar</desc>
<before>&lt;div id="foobar"&gt;&lt;b&gt;&lt;/b&gt;&lt;span id="foo"&gt;&lt;/span&gt;&lt;/div&gt;</before>
<code>$("*").index( $('#foobar')[0] )</code>
<result>0</result>
</examples>
<examples>
<desc>Returns the index for the element with ID foo within another element</desc>
<before>&lt;div id="foobar"&gt;&lt;b&gt;&lt;/b&gt;&lt;span id="foo"&gt;&lt;/span&gt;&lt;/div&gt;</before>
<code>$("*").index( $('#foo')[0] )</code>
<result>2</result>
</examples>
<examples>
<desc>Returns -1, as there is no element with ID bar</desc>
<before>&lt;div id="foobar"&gt;&lt;b&gt;&lt;/b&gt;&lt;span id="foo"&gt;&lt;/span&gt;&lt;/div&gt;</before>
<code>$("*").index( $('#bar')[0] )</code>
<result>-1</result>
</examples>
</method></docs>
