'setInterval() not working for making a digital clock

This codepen is pretty much self-explanatory of my problem. I'm trying to make a simple digital clock, but it's not ticking for some reasons. This is the portion I'm having problem:

var date = new Date();
var time = date.toLocaleTimeString();
setInterval(function()
{
  $("#time").text(time);
}, 1000);

Any lead would be greatly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source