开发者

DOM undefined error

开发者 https://www.devze.com 2023-01-22 20:13 出处:网络
I\'m suddenly getting error like this on firebug. What开发者_StackOverflow do I look for? What does it mean?

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 DIVs. If you find any DIVs, 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. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消