From 75e5dc44c396d6ae2116c724e912624b423b7f5c Mon Sep 17 00:00:00 2001 From: Thanapat Date: Thu, 13 Feb 2025 11:11:53 +0700 Subject: [PATCH] update remove index --- script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 356548d..e3cb6f6 100644 --- a/script.js +++ b/script.js @@ -68,15 +68,17 @@ const messages = [ ]; let messageIndex = 0; +let removeIndex = 0; function handleNoClick() { const noButton = document.querySelector('.no-button'); const yesButton = document.querySelector('.yes-button'); noButton.textContent = messages[messageIndex]; messageIndex = (messageIndex + 1) % messages.length; + removeIndex++; const currentSize = parseFloat(window.getComputedStyle(yesButton).fontSize); yesButton.style.fontSize = `${currentSize * 1.5}px`; - if(messageIndex>messages.length*2) document.querySelector('.no-button').remove() + if(removeIndex>messages.length*2) document.querySelector('.no-button').remove() } function handleYesClick() {