var list = document.getElementsByClassName("lang"); var arrList = Array.from(list); arrList.sort((x,y) => { return x.innerText.toLowerCase()>y.innerText.toLowerCase() ? 1:-1; } ); arrList.forEach(x => console.log(x.innerText)); var afList = document.getElementById("test-list"); afList.innerHTML = ""; arrList.forEach(x => afList.appendChild(x));
Sign in to make a reply
_Lince_