I'm using the next function to count every item inside a div and echo the index number for each.
Is there a way to achieve the exact same but starting from the biggest number to the smallest? Sort of flip what's in here
Thanks in advance
$(function() {
$(".grid").each(function() {
$(this).find('.num').each(function(i) {
$(this).text(++i);
$(this).text(function (i, n) {
var result = Number(n) + 0;
if ( result < 10 ) {
return "0" + result + ".";
} else {
return result + ".";
}
});
});
});
});