I have a list of dozens DIVs like
<div data-sort="7.5"></div>
<div data-sort="3.2"></div>
<div data-sort="2.15"></div>
<div data-sort="-1.78"></div>
<div data-sort="-2.39"></div>
and so on and I get new DIVs with an ajax request. I need to insert the new DIV so the order with “data-sort” remains intact in descending order.
It’s not as optimal as can be, but I would just sort the divs each time the ajax request completes:
If that takes too long, you’ll just have to cycle through the divs (via
.each?) and find the first one whosedata-sortis smaller.