最佳答案
我尝试循环访问像这样的子节点:
var children = element.childNodes;
children.forEach(function(item){
console.log(item);
});
但是,它输出 Uncaught TypeError: undefined is not a function
由于 forEach
的功能。我也尝试使用 children
而不是 childNodes
,但没有什么改变。
有人知道是怎么回事吗?