DOM undefined error
I'm suddenly getting error like this on firebug. What开发者_StackOverflow do I look for? What does it mean?
nodes.item(i).getElementsByTagName("div")[0] is undefined
It means that there is no element under nodes.item(i)
with the tagName
div.
You've got a collection of elements in nodes
. Apparently, you're looping through them with i
. Then, IN EACH ONE, you're looking for any DIV
s. If you find any DIV
s, you're examining the first ("zero-th") one.
So, apparently, one of your item[i]
s is missing the DIV
that your brain thinks is there, but the computer says is not actually there.
And, since it can't find the "zero-th" one, that means there are NO DIVS AT ALL in that child.
So, look for that. :)
精彩评论