jquery - javascript simple countdown with refresh function -
i getting output of 00 min nan sec. know may wrong code?
desired outcome, countdown 5min add class 'ended'
using jquery.countdown.js
thank you.
$(function() { var enddate = "05:00"; $('.countdown.callback').countdown({ date: enddate, render: function(data) { $(this.el).html("<div>" + this.leadingzeros(data.min, 2) + " <span>min</span></div><div>" + this.leadingzeros(data.sec, 2) + " <span>sec</span></div>"); }, onend: function() { $(this.el).addclass('ended'); } }).on("click", function() { $(this).removeclass('ended').data('countdown').update(enddate).start(); }); });
if recall correctly, enddate variable not valid. believe needs follow javascript method of getting date might need this
var enddate = new date(); enddate.setminutes(enddate.getminutes() + 5); // adding 5 minutes current time
Comments
Post a Comment