The error is very simple but can not find.
I'm learning how to use the DOM CORE API.
I created a DIV, and inside I put a UL.
I am alerting who is the first child of the DIV, and the result is giving OBJECT TEXT
. instead of giving OBJECT UL LIST
.
follow the code.
<html lang="pt-BR">
<head>
<title>Dom Core Api</title>
<meta charset="utf-8">
<script src="js/testDom.js"></script>
</head>
<body>
<div>
<ul><li>Rodrigo</li>
<li>Robson</li>
</ul>
</div>
</body>
</html>
javaScript code
window.onload = function() {
var div = document.getElementsByTagName("div").item(0);
alert(div.firstChild);
}