Where was an element placed after sorting?
<p>Hod do you determine the new index of an element sorted using jQuery UI sortable?</p>

<p>i have an un-ordered list and every list item has an id...when i drag it up or down and place it, i need to know the new position (vaguely speaking, like the id of element that moved to make room for this new element)  ...is that even possible?
i tried using the .mousedown and .mouseup events and getting this.id...but it returns the same element being dragged both the times.  </p>

<p>In short we knw the element being dragged but hw can we know where it was finally laid to rest?</p>

<p>the code is simple...it is actually a table</p>

<pre><code>---------HTML----------------
&lt;table id="activities"&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Activity Name&lt;/th&gt;&lt;th&gt;Activity Number&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr id="node-1"&gt;
&lt;td&gt;Welcome&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr id="node-2"&gt;
&lt;td&gt;Eat&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr id="node-3"&gt;
&lt;td&gt;Walk&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr id="node-4"&gt;
&lt;td&gt;Sleep&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</code></pre>

<p>Now im making the rows sortable by jquery:</p>

<pre><code>$("#activities tbody").sortable();
</code></pre>

<p>Now when the user drags a row up or down, i need to change the activity number accordingly...for example if he drags the "welcome" row down under the "eat" row, that will mean the the activity number of "welcome" row is now 2 (which was previously 1) and the activity number of "eat" row is 1....to display the new updated table with correct activity number, i need to know the where it was dropped. </p>
