How to set innerHTML to a variable?
Hi everyone, I have a problem, again. It shows me this:
Can somebody fix this? Did I made something wrong?
The error isn't the variable the error is the element.
You put the script.js before any of the HTML was set, so there are 2 ways to fix this.
move script tag
move it to the end of the page like this:
add window onload
wait until the page has loaded before executing
You are getting this error because you are using the same script file in index.html too and index.html hasn't got an element with the id currentTime. Edit: Sorry I didn't see the other currentTime in index.html