Matej Posted September 16, 2014 Share Posted September 16, 2014 (edited) Hello , i have this script http://jsfiddle.net/zKvVj/4/ but the second loop ain't working the error says Cannot read property 'children' of undefined can someone please help ? :)Thanks for answers // yes i know that script is wrong - will not work but im wondering why does that loop not work Edited September 16, 2014 by Matej Link to comment Share on other sites More sharing options...
justsomeguy Posted September 16, 2014 Share Posted September 16, 2014 One problem is that you're incrementing i inside both for loops. Another problem is that nodes do not have a property called children. Link to comment Share on other sites More sharing options...
Ingolme Posted September 16, 2014 Share Posted September 16, 2014 There is a children property but Internet Explorer only implemented it properly in versions 9 and up. The difference between children and childNodes is that children only contains element nodes. Most of us long-time Javascript programmers were used to using the childNodes property because it's one thing you can be sure will work on all browsers. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now