UPDATED: Getting the index of a child div using jQuery
<p>I need to be able to dynamically determine what the index of a certain div inside another div is. For example:</p>

<pre><code>&lt;div id="parent"&gt;
    &lt;div id="div-0"&gt;&lt;/div&gt;
    &lt;div id="div-5"&gt;&lt;/div&gt;
    &lt;div id="div-1"&gt;&lt;/div&gt;
    &lt;div id="div-2"&gt;&lt;/div&gt;
    &lt;div id="div-3"&gt;&lt;/div&gt;
    &lt;div id="div-4"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>For any of those I need to be able to know if a given div is the first, second etc...</p>

<p>EDIT:
Ok obviously I haven't explained this well. I tried all of the below and all I get is 0 every time. I have edited the example above to reflect what is happening. So given the updated example what I need to be able to do is the following:</p>

<pre><code>var index = $('#div-4').index();
</code></pre>

<p>Currently this is only returning 0 every time.</p>
