JavaScript innerHTML error?

Upon inspecting my page, I get these errors:

Uncaught TypeError: Cannot set property 'innerHTML' of null at currentdate.js:10
Uncaught TypeError: Cannot read property 'innerHTML' of null at windchill.js:2

var high =67;
var tempaverage= document.getElementById("temp").innerHTML;
var wSpeed = document.getElementById("windspeed").innerHTML;

var windchill= 35.74 + 0.6215 * tempaverage - 35.75 * Math.pow(wSpeed, 0.16) + 0.4275 * tempaverage * Math.pow(wSpeed, 0.16);
windchill= Math.round(windchill) + "°F";

document.getElementById ("windchill").innerHTML= windchill;

What does line 10 of currentdate.js look like?

What does line 2 of windchill.js look like?

What does you html look like?

Do you have your full project online so we can take a look at it?

The error implies you’re trying to change the property of a variable which does not exist.


brokenVariable.innerHTML = 'This does not work';

Check and see why your broken variable is not properly being assigned.