Weather App Updating DOM Help


#1

My weather app is not updating. Im using jquery to update the text in the dom but it doesn’t change the text. I was wondering why this is


#2

If you open your browser’s debug console (Windows/Linux Ctrl+Shift+J, Mac OS Command+Option+J), you will see the error:

Uncaught TypeError: Cannot read property 'getHours' of undefined

This is because you are using date instead of dateObj in this line of code:

var date = date.getHours() + ":" + date.getMinutes() + " " + date.getMonth() + " " + date.getDate(); //get hours, min, day, month

After fixing that, you’ll get another error:

document.getElementByTagName is not a function

because this line of code should say getElementsByTagName (Elements is plural):

var body  = document.getElementsByTagName("body")[0]; //access body element