You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[
^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[
^]
Quote:
Uncaught typeerror: cannot read property 'childnodes' of null
For some reasons, a variable that you expect to be an object have failed to initialize and is set to Null instead. Thud the error when you try to access.
The problem is that you fail to check that the object is Ok after creation.