var list = document.getElementById('list'); [...list.children] .sort( (a, b) => a.getAttribute('data-date') - b.getAttribute('data-date')) .forEach( node => list.appendChild(node));