I saw a similar question at : The simplest possible JavaScript countdown timer?
I did an update, see it below
HTML
<body>
<div>You have <span id="time">00:20</span> to bid!</div>
<button>Bid !</button>
</body>
JS
var myCounter= (function() {
var secondsleft= '';
var timeleftinterval= null;
var startTimer= function(duration) {
var me= this;
var timer = duration;
var display = $('#time');
me.timeleftinterval= setInterval(function () {
minutes = parseInt(timer / 60, 10)
seconds = parseInt(timer % 60, 10);
me.secondsleft= timer;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.text(minutes + ":" + seconds);
if(--timer < 0) {
clearInterval(me.timeleftinterval);
}
}, 1000);
};
var increaseTime= function(secondstoincrease) {
clearInterval(this.timeleftinterval);
this.secondsleft += secondstoincrease;
this.startTimer(this.secondsleft);
};
return {
startTimer: startTimer,
increaseTime: increaseTime
}
})();
jQuery(function ($) {
myCounter.startTimer(20);
$('button').click(function() {
myCounter.increaseTime(60);
});
});
http://jsfiddle.net/df773p9m/10/
Does it help you?