九州体育网 - 十年信誉网站

关于作者

Discuss / JavaScript / paixu

paixu

Topic source

烊烊-永远的小王子

#1 Created at ...

var list = document.getElementById('test-list'); var i,arr=[];

for (i=0;i<list.children.length;i++){ arr.push(list.children[i].innerText); } console.log(arr); arr.sort(); console.log(arr);

for (i=0;i<list.children.length;i++){ list.children[i].innerText = arr[i]; }


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.