Closed rfpotrero closed 2 years ago
Add id="category-btn" to HTML button element.
The issue 23 added a else statement to catch any unrecognised category. This introduced a bug in the code since the event listener above was attached to all the button types. The Play again buttons were triggering the alert error handling.
// The below create event listener for clicks in the category buttons. document.addEventListener("DOMContentLoaded", function () {
document.getElementById("draw-graphic").innerHTML = ` <img style="height:100%;width:100%;" src="assets/images/48361197.jpeg" alt="Drawn of a hangman" />`;
let buttonCate = document.getElementById("category-btn");
buttonCate.addEventListener("click",gameInit);
});