Forum Moderators: open
<div id="container" class="box">
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
<p>Paragraph 5</p>
</div>
in firefox the div container get 11 children but IE get only 5 children. what is the problem? can anyone explain me?
<script>
function getInfo(nodeID)
{
var con = document.getElementById(nodeID);
alert(con.childNodes.length);
}
</script>
If you do not expect any text nodes among the children then skip them, else skip any text nodes that contain only white space.
If rewriting html is an option, the following layout is ugly but avoids issue.
<div id="container" class="box"
><p>Paragraph 1</p
><p>Paragraph 2</p
><p>Paragraph 3</p
><p>Paragraph 4</p
><p>Paragraph 5</p
></div>