@Eileenpk
Posted
Hi Felipe,
Your project looks really good, awesome work!
In regards to removing the event listener when the number of pledges left is zero, did you try
EventTarget.removeEventListener()
? I think it might be a good way to simplify your code.
Here is a link that talks about it more - removeEventListener
Hope you found this helpful!
- Let's connect on LinkedIn! - @Eileenpk
Marked as helpful
@felipetn1989
Posted
Hi Eileen,
Thanks for the feedback!
I tried using removeEventListener(), but it wouldn't work because my addEventListener("click", () => openSelectionPage(index)) had an anonymous arrow function that the code didn't recognize as the same function when I used removeEventListener("click", () => openSelectionPage(index)). And I couldn't use something like addEventListener("click", openSelectionPage(index)) because then the function would be called immediately on page load. I wasn't able to find a workaround for that, so that's why I decided to create a function that would assign click events only for the buttons that had .available_button as a class