// sort list: var i = 0, arr = [], t = document.getElementById('test-list'); for(i = 0; i < t.children.length; ++i){ arr.push(t.children[i].innerText); } arr.sort(); for(i = 0; i < t.children.length; ++i){ t.children[i].innerHTML = arr[i]; }
Sign in to make a reply
eversliver
// sort list: var i = 0, arr = [], t = document.getElementById('test-list'); for(i = 0; i < t.children.length; ++i){ arr.push(t.children[i].innerText); } arr.sort(); for(i = 0; i < t.children.length; ++i){ t.children[i].innerHTML = arr[i]; }