I'm trying to pause and then play a setInterval
loop.
After I have stopped the loop, the "start" button in my attempt doesn't seem to work :
input = document.getElementById("input");
function start() {
add = setInterval("input.value++", 1000);
}
start();
<input type="number" id="input" />
<input type="button" onclick="clearInterval(add)" value="stop" />
<input type="button" onclick="start()" value="start" />
See Question&Answers more detail:os