@WestonVincze
Posted
No worries! Happy to help. I took a look at the code and found the issue.
This is the culprit.
const questionHideContent = question.querySelector(".hide");
The issue here is that querySelector only checks child nodes and .hide
is actually a sibling.
To solve this, all we have to do is change the above line to:
const questionHideContent = question.parentNode.querySelector(".hide");
As a side note, your solution no longer requires the active
class, since it was previously used to determine whether or not .hide
should be hidden or not.
Marked as helpful
@Yetco
Posted
Thank you for your help, I really appreciate it @WestonVincze .