2
JavaScript code:
document.getElementById("hour").innerText
or
document.getElementById("hour").innerHTML
divs do not have a value. It is not an input.
You want to use innerHTML or innerText/textContent.
The .value
property applies to form elements (inputs), not divs. The simplest way to get the contents of your div element is with .innerHTML
:
document.getElementById('hour').innerHTML;