Skip to main content

Posts

Showing posts from March, 2018

Uncaught TypeError

  Now from beginning of the tutorial series we notice that we write our JavaScript in head section on our html page but what happen in this that we write our JavaScript within our body tag and after our <label> </label>tags ,what happen if we use JavaScript within head lets take look   refreshing our page in browser and we see blank screen ,now we have to check the error so if you are using google chrome  in windows use Ctrl+Shift+J and on Mac Cmd+Option+J ,console screen open on your browser which show an error like this Uncaught TypeError:Cannot set property 'innerHTML' of null at (your code line number) click on that line Now this is time to understand what going behind the scene of our code When we write JavaScript code inside the <script> tag  which is present in <head>section of our HTML file,our JavaScript execute by our browser rendering engine even before the whole DOM is loaded because it load our whole DOM from top to