I am trying to display the current time as the value in my input upon loading the page. However, its not working for some reason. Any suggestions? Thanks for any help.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="Scripts/Global.js"></script>
<script src="Scripts/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="Styles/Design.css">
</head>
<body>
<input type="time" id="theTime">
<script>
$(document).ready( function() {
var current = new Date();
var minute = (now.getMinutes() + 1);
var seconds = now.getSeconds();
if(minute < 10)
minute = "0" + minute;
if(seconds < 10)
seconds = "0" + seconds;
var today = now.getFullYear() + '-' + minute + '-' + seconds;
$('#theTime').val(today);
});
</script>
</body>
</html>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…