i have a problem about getting order of my divs.

Scenario : i have a structure like this :

```
<div class="container">
<div class="element" id="element1">
<div class="element" id="element2">
<div class="element" id="element3">
<div class="element" id="element4">

```

but i am re-ordering / deleteing / adding some elements related to some conditions
So suppose that final structure like this: 

```
<div class="container">
<div class="element" id="element6">
<div class="element" id="element2">
<div class="element" id="element8">
<div class="element" id="element4">
<div class="element" id="element1">
<div class="element" id="element7">

```

and finally i want to get a list of elements in final order
I'am using 

```
var ord= '';
for (i=1;i<=($('.element').length);i++){
  var index = $('#element'+i).index();
  ord+= index+' / ';
}

```

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

```
var index = indexof($('#element'+i)); // ok this is not lookink like correct :)

```

But no way i found.