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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…