Discuss / JavaScript / 怪怪的

怪怪的

Topic source

Sky_Watcher

#1 Created at ... [Delete] [Delete and Lock User]
var i;
var list = document.getElementById('test-list');
var Lang = ['Swift','ANSI C','DirectX'];
for(i = list.children.length - 1; i >=0; i--)
{
    for (var j in Lang){
        if(list.children[i].innerText === Lang[j]){
            console.log('heh');
            list.removeChild(list.children[i]);
            i--;
        }
    }
}

  • 1

Reply