I have this HTML:
<div indice="1">first</div>
<div indice="3">third</div>
<div indice="2">second</div>
<button onclick="organize();">Sort</button>
I need that when I click in button the same html to be sort asc using the atrributte “indice” and the dom become look like this:
<div indice="1">first</div>
<div indice="2">second</div>
<div indice="3">third</div>
Try this using javascripts array sort method
http://jsfiddle.net/nPbk8/