When I load my page, a nodeList gets created, and it looks like this:
[text, h4, text, span, br, input, br, span, br, input, br, span, br, input, br, span, br, input, br]
I created a simple for
loop that loops through all these elements and deletes each one of them from the DOM. (all the elements are in a <section>
)
Here's the loop:
for(element in videoTitlesElement.childNodes){
if(!isNaN(element)){
videoTitlesElement.removeChild(
videoTitlesElement.childNodes[element]);
}
}
But, by the end of the loop, the nodeList looks like this:
[h4, span, input, span, input, span, input, span, input]
not all elements got removed. Why?
Thanks.