I have a container element containing div elements with a data-index value. I want to reorder the elements by the data-index, so they appear as 1, 2 and 3.
<div class="container">
<div class="col-md-4" data-index="3">Col 3</div>
<div class="col-md-4" data-index="1">Col 1</div>
<div class="col-md-4" data-index="2">Col 2</div>
</div>
So how can I sort the elements by the data-index value?