I have the following div in HTML:
<div id = "datum">contents here</div>
In JavaScript I have the following code to display the date:
var myDate= new Date();
document.getElementById('datum').innerHTML = myDate;
I get the following error in my console:
TypeError: document.getElementById(...) is null script.js:5:5
I have already tried to put the code above the div tag, since JavaScript reads from top to bottom, but it is still the same issue.
Thank you in advance.