// sort list: var i,j, c =[], list = document.getElementById('test-list'), length = list.children.length;
for (i = 0; i < length; i++) { c[i] = list.children[i].innerText; }
for(i = 0; i < length; i++){
var iText = c[i]; for(j = i+1; j < length; j++){ var jText = c[j]; if( iText > jText){ list.insertBefore(list.children[j], list.children[i]); } }
}
Sign in to make a reply
jiangqr
// sort list: var i,j, c =[], list = document.getElementById('test-list'), length = list.children.length;
for (i = 0; i < length; i++) { c[i] = list.children[i].innerText; }
for(i = 0; i < length; i++){
}