Make a countdown from timer

countdown, javascript, jquery

Solution

Counts from 0 to 60.

var count = 0, timer = setInterval(function() {
    $("#counter").html((count++)+1);
    if(count == 59) clearInterval(timer);
}, 1000);

Or from 60 to 0:

var count = 60, timer = setInterval(function() {
    $("#counter").html(count--);
    if(count == 1) clearInterval(timer);
}, 1000);

Problem

Is there any way to make a countdown with 60 seconds... Here is the code for timer: ``` var count = 0; var timer = $.timer(function() { $('#counter').html(++count); }); timer.set({ time : 1000, autostart : true }); ``` What I need to chabge to make this code like countdown> THANKS

Original source