How can I program a button to disable after being pressed 10 times in less than a minute, but continue counting if not pressed for 1 minute?
function buttonClicked() {
if (totalCount + accCounter > 9) {
document.getElementById("btn").disabled = true;
}
}
document.getElementById('btn').onclick = function() {
upClickCounter();
buttonClicked()
}
function upClickCounter() {
const clickCounter = document.getElementById("clicker");
const totalClickCounter = document.getElementById('totalCounter');
accCounter++;
clickCounter.children[0].innerText = '+' + accCounter;
totalClickCounter.innerText = totalCount + accCounter;
}
let accCounter = 0;
let totalCount = 0;
<button id="btn">Click me</button>
<div id="clicker">
<span></span>
</div>
<div id="totalCounter"></div>