diff --git a/app.js b/app.js index 8acbdef..ca86327 100644 --- a/app.js +++ b/app.js @@ -83,6 +83,8 @@ function compare(player, computer) { resultEl.innerText = won; youScore.innerText = score.you; } + // enable buttons again + ResetButtonsState(); // playerHand.classList.remove('shake') // computerHand.classList.remove('shake') } @@ -126,6 +128,32 @@ resetBtn.addEventListener("click", () => { }); +/* Disable button untill */ +function disableButton() { + + // Get the button element by its ID + var rockBtn = document.getElementById("rockButton"); + var paperBtn = document.getElementById("paperButton"); + var scissorBtn = document.getElementById("scissorButton"); + + // Disable the button + rockBtn.disabled = true; + paperBtn.disabled = true; + scissorBtn.disabled = true; +} + +function ResetButtonsState() +{ + var rockBtn = document.getElementById("rockButton"); + var paperBtn = document.getElementById("paperButton"); + var scissorBtn = document.getElementById("scissorButton"); + + // Disable the button + rockBtn.disabled = false; + paperBtn.disabled = false; + scissorBtn.disabled = false; +} + // // Mapping // // 0 -> rock, 1->paper, 2->scissor // const options = ["rock", "paper", "scissor"];