From 3f9d3db7318eb9a3de64d12cc07573b807ae9ae3 Mon Sep 17 00:00:00 2001 From: amb54 Date: Fri, 19 May 2017 19:53:13 -0700 Subject: [PATCH] It works : ). --- index.html | 19 +++++++++++++++++-- index.js | 16 +++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 191d3cc..eb03735 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,23 @@ -
+ +
+ + + + +
+ + + + + - + + diff --git a/index.js b/index.js index 877a3aa..c5b83cf 100644 --- a/index.js +++ b/index.js @@ -1 +1,15 @@ -// Your code here +$(document).ready(function() { + + // var intervalID = window.setInterval(ticking, 1000); + var tick = window.setInterval(function(){ticking()}, 1000); + + var ticking = function() { + var clock = new Date(); + var hours = ((clock.getHours() < 10) ? '0' : '') + clock.getHours() + var minutes = ((clock.getMinutes() < 10) ? '0' : '') + clock.getMinutes() + var seconds = ((clock.getSeconds() < 10) ? '0' : '') + clock.getSeconds() + var timeNow = $('

' + hours + ':' + minutes+ ':' + seconds+ '

'); + $('#clock').html(timeNow); + } + +});