var down=function(a,b){alert(a)}
Array.prototype.sort.call(table.tBodies[0].childNodes,down)
Array.prototype.sort.call([0,1,2,3],down)
Why do I not
I correct the code of gaetanoM, this one works with IE :
window.onload = function() {
var parentNode = document.getElementById('test-list');
var e = document.getElementById('test-list').children;
[].slice.call(e).sort(function(a, b) {
if (a.textContent > b.textContent) return 1;
if (a.textContent < b.textContent) return -1;
return 0;
}).forEach(function(val) {
parentNode.appendChild(val);
});
}
- Scheme
- JavaScript
- Python
- Ruby
- Haskell
- Tata
- Aaaaa
- Drue