I am trying to make a timer start counting down. I think my next step is to make the countdown function to actually work. What would be the best approach for this?
JavaScript and HTML codes below:
// Set the default timer as 25:00
var timer = document.getElementById("mytime");
var counter = setInterval(function(){
countdown()}, 1000);
//user clicks the 'start' button and timer starts counting down
function countdown(minutes, seconds){
timer.value = "17:30:00"; //default value
document.getElementById("btn").innterHTML = counter;
counter--;
};
var click = document.getElementById("btn");
btn.addEventListener("click", countdown); //"click" as DOM Object?
btn.addEventListener("click", stopcounting);
<head>
<title>Pomodoro Timer</title>
</head>
<body>
<h1>POMODORO TIMER</h1>
<div id="main">
<input type="time" id="mytime">
<button id="btn"> start </button>
</div>
</body>