diff --git a/js/app.js b/js/app.js index f5b5ab0..85d1ba9 100644 --- a/js/app.js +++ b/js/app.js @@ -146,6 +146,9 @@ function checkMatchCard(item) { // function to rmove class open and show from cards [first and second card] function clearSelectedCards() { + let allCards = document.querySelectorAll('.card:not(.match)'); + allCards.forEach(card => card.removeAttribute('onclick')); + setTimeout(() => { if (firstCard) { firstCard.classList.remove('open'); @@ -158,6 +161,8 @@ function clearSelectedCards() { secondCard.classList.remove('show'); secondCard = null; } + + allCards.forEach(card => card.setAttribute('onclick', 'startGame(this)')); }, 1000); } @@ -258,4 +263,4 @@ playAgain(); * + if the cards do not match, remove the cards from the list and hide the card's symbol (put this functionality in another function that you call from this one)[Done] * + increment the move counter and display it on the page (put this functionality in another function that you call from this one)[Done] * + if all cards have matched, display a message with the final score (put this functionality in another function that you call from this one)[Done] - */ \ No newline at end of file + */