Discuss / JavaScript / &nbsp

&nbsp

Topic source

_Lince_

#1 Created at ... [Delete] [Delete and Lock User]
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));

  • 1

Reply