I'm trying to countdown 60 seconds once I click the begin button and at 0 I don't want to just hide the counter, I want it to be reset. I ran into 2 problems: When I click the begin button again it's not starting over. The begin button is not disabled once I click it to start the countdown. While its counting down, when I press the begin button it accelerate the countdown. Any help is appreciated, here is the code:
function begin() {
$('#begin').prop('disabled');
myTimer = setInterval(function() {
$('#timing').html(timing);
if (timing === 0) {
alert('Too late! Try again');
clearInterval(myTimer);
$('#timing').hide();
}
timing--;
}, 1000);
}