need a knockout timer for the project
I need a knockout timer for my project which can restart after it reaches
0 on a click. I have the following code but this wont restar. Can somebody
help me.
this.countDown = ko.observable();
ko.bindingHandlers.timer = {
update: function (element, valueAccessor) {
var sec = $(element).text();
var timer = setInterval(function () {
$(element).text(--sec);
if (sec == 0) {
clearInterval(timer);
}
}, 1000);
}
};
No comments:
Post a Comment