Woppi
Woppi

Reputation: 5431

DOM undefined error

I'm suddenly getting error like this on firebug. What do I look for? What does it mean?

nodes.item(i).getElementsByTagName("div")[0] is undefined

Upvotes: 4

Views: 947

Answers (2)

Ben
Ben

Reputation: 57209

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. :)

Upvotes: 1

Motti
Motti

Reputation: 114695

It means that there is no element under nodes.item(i) with the tagName div.

Upvotes: 2

Related Questions