I set up a clock with timing event and want to show in the html file. I have 2 files which are js and html file. js is to configure the clock with timing event and the html file is to show the timing.
My code is found below.
clock.html:
<html>
<head>
<title>Clock with a timing event</title>
<script src="clock.js"></script>
<script type="text/javascript" src="/Cesium-1.34/ThirdParty/jquery-1.11.3.min.js"></script>
</head>
<body>
<h1 id="txt"></h1>
</body>
</html>
js:
$(function () {
function startTime() {
var today = new Date();
var h = today.getHours();
var min = today.getMinutes();
var s = today.getSeconds();
var y = today.getFullYear();
var mon = today.getMonth()+1;
var d = today.getDate();
min = checkTime(min);
s = checkTime(s);
mon = checkTime(mon);
d = checkTime(d);
document.getElementById('todaytime').innerHTML = " "+ d + "/" + mon + "/" +y + " " + h + ":" + min + ":" + s + " SGT ";
var t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
});
The error states:
"Uncaught ReferenceError: $ is not defined"
My question is how to get the values from the js and show in the html file.