-1

I am building an analog clock in JS/css/html, and have some trouble with this piece

var seconds = $(".seconds")
var minutes = $(".minutes")
var hours = $(".hours")

setInterval(update(), 1000)

function update(){
  var d = new Date()
  var s = d.getSeconds()
  var m = d.getMinutes()
  var h = d.getHours()
  seconds.css("transform", "rotate("+s*6+"deg)")
}

The css rotating style works once and it stops, I appreciate any help with this

ZenKurd
  • 119
  • 1
  • 1
  • 10

1 Answers1

0

Replace update() with update

var seconds = $(".seconds")
var minutes = $(".minutes")
var hours = $(".hours")

setInterval(update, 1000)

function update(){
  var d = new Date()
  var s = d.getSeconds()
  var m = d.getMinutes()
  var h = d.getHours()
  seconds.css("transform", "rotate("+s*6+"deg)")
}