ERROR WHILE BUILDING WEATHER APP – Uncaught TypeError: Cannot read property 'addEventListener' of null

I am trying to follow along and build a weather app but I keep getting this message.

Uncaught TypeError: Cannot read property ‘addEventListener’ of null

I’ve built a weather app before and it worked out fine but for some reason this is not working. I’ve tried moving the JS script into the bottom of the body. That doesn’t work.

Please help.
Thank you.

JS FILE
HTML FILE
ERROR MESSAGE

80 thoughts on “ERROR WHILE BUILDING WEATHER APP – Uncaught TypeError: Cannot read property 'addEventListener' of null”

  1. Browser will execute code line by line, as you have included script before body, your app.js file will gets executed even before document is rendered on webpage.

    Just try moving below line before </body>

    <script src="app.js"></script>
    
    Reply

Leave a Comment