jquery - How to sort divs according to their dates or ids? -


i have these divs dates ids.

<div id="20160106"></div> <div id="20160105"></div> 

and on.

is there way sort them latest earliest using jquery?

use sort.

var divid = []; var sorted_arr=[]; $("div").each(function() {     divid.push($(this).prop("id"));      sorted_arr = divid.sort();                  //divid.reverse(); })  alert(sorted_arr);// test 

fiddle


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -