View Single Post
Old 09-13-2012, 05:34 PM   PM User | #2
DaveyErwin
Regular Coder

 
Join Date: Aug 2010
Posts: 814
Thanks: 12
Thanked 168 Times in 166 Posts
DaveyErwin is on a distinguished road
Yes the numbers are different
but they are both correct,
browsers other than IE add
an empty text node to
empty divs

Code:
 
function getParentLength() {
 var parente = document.getElementById('itemlist');
 var nodes=parente.childNodes;
 alert(nodes.length);
 a="";
 for(var i=0; i<nodes.length; i++)
  a += nodes[i].nodeType +"\n"
 alert(a)
}
DaveyErwin is offline   Reply With Quote