I have this code: (Stripped pieces not related to question)
$(function() {
mins = 0; //Set the number of minutes you need
//secs = 0;
function Decrement(mins){
var secs = mins * 60;
var currentSeconds = 0;
var currentMinutes = 0;
if(currentSeconds <= 9){ currentSeconds = "0" + currentSeconds; }
secs--;
document.getElementById("commercial").innerHTML = "Please wait "+currentMinutes + ":" + currentSeconds; //Set the element id you need the time put into.
if(secs !== -1){ alert("Done!"); }
}
function runCommercial(time){
$('#commercial').html('Plase wait 8:00');
$('#commercial').attr("disabled", "disabled");
mins = 8;
setInterval('Decrement(8)',1000);
}
$('#commercial').click(function(){
runCommercial(30);
});
});
Whenever I click the commercial button, the button text gets set to 8:00 as it should, altough it won't count down, instead it gives me "Decrement() is not defined" in the dev console of firefox. Why is this happening and how do I fix it?
Thanks.