I'm trying to loop through childNodes like this:
var children = element.childNodes;
children.forEach(function(item){
console.log(item);
});
However, it output Uncaught TypeError: undefined is not a function
due to forEach
function. I also try to use children
instead of childNodes
but nothing changed.
Does anybody know what's going on?