rulesBtn.addEventListener('click', () => {
isModalShowing = !isModalShowing;
rulesContainer.style.display = !isModalShowing ? 'block' : 'none';
rulesBtn.textContent = !isModalShowing ? 'Hide Rules' : 'Show Rules';
})
Hello. This is my code and it is functional. It does everything the instructions ask, but the site just won’t accept it. It says that “When your rulesBtn
is clicked, your rulesContainer
should be visible.” which is visible. I tried other methods that were functional as well, but in vain. The site requires a specific method that I can’t figure out what it is, and the site doesn’t help with a hint or something. Can you please help me?
Thank you for reading.
This also is functional:
rulesBtn.addEventListener('click', () => {
if (rulesBtn.textContent === 'Show rules') {
isModalShowing = !isModalShowing;
rulesContainer.style.display = 'block';
rulesBtn.textContent = 'Hide Rules';
} else if (rulesBtn.textContent === 'Hide Rules') {
isModalShowing = !isModalShowing;
rulesContainer.style.display = 'none';
rulesBtn.textContent = 'Show rules';
}
})