I have made a bit of research, but not get any result. This is the situation. I have an html file and a javascript file. The html is:
<html>
<head>
<script src="js/calculateRemainigTime.js"></script>
<script>
reservationTime();
</script>
</head>
<body>
<button onclick = "reservationTime()">Start</button>
<p id="demo">Result Here</p>
</body>
The javascript file is:
function reservationTime()
{
var date = new Date();
var currHour = date.getHours()
var x = document.getElementById("demo");
x.innerHTML = "The example time is: " + currHour;
}
The problem is that when I press the Start button, the text of the "p" tag with id = "demo" does not change. Thanks!
scriptto the end of yourbody<script src="calculateRemainigTime.js"></script>