Tell us what’s happening:
I do not understand where my error is, the code works. The rules container is visible and invisible when I press the button. Yet I am still getting the rulesBtn is clicked, your rulesContainer should be visible. Finally I keep getting the error of rules Container should not be visible initially.
I did at one point not have the rulesBtn is clicked error in the console, yet my code I’m pretty sure was the exact same as it is now. Could be wrong though, I tried both display and visibility. Same error for both.
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
rulesBtn.addEventListener("click", () => {
isModalShowing = !isModalShowing;
rulesContainer.style.display = isModalShowing ? "block" : "none";
rulesBtn.textContent = isModalShowing ? "Hide rules" : "Show rules";
});
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Safari/605.1.15
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 2