title: How to get order of reordered elements
body: <p>i have a problem about getting order of my divs.</p>
  
  <p>Scenario : i have a structure like this :</p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;div class="element" id="element1"&gt;
  &lt;div class="element" id="element2"&gt;
  &lt;div class="element" id="element3"&gt;
  &lt;div class="element" id="element4"&gt;
  </code></pre>
  
  <p>but i am re-ordering / deleteing / adding some elements related to some conditions
  So suppose that final structure like this: </p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;div class="element" id="element6"&gt;
  &lt;div class="element" id="element2"&gt;
  &lt;div class="element" id="element8"&gt;
  &lt;div class="element" id="element4"&gt;
  &lt;div class="element" id="element1"&gt;
  &lt;div class="element" id="element7"&gt;
  </code></pre>
  
  <p>and finally i want to get a list of elements in final order
  I'am using </p>
  
  <pre><code>var ord= '';
  for (i=1;i&lt;=($('.element').length);i++){
    var index = $('#element'+i).index();
    ord+= index+' / ';
  }
  </code></pre>
  
  <p>but it gives me the indexes of elements in creation order, not final order.
  Finally, i think that i need to get the item id from its index like</p>
  
  <pre><code>var index = indexof($('#element'+i)); // ok this is not lookink like correct :)
  </code></pre>
  
  <p>But no way i found.</p>