Attaching an Onclick Listener
In the load method, there is a call to setupListener that we need to flesh out now. If you examine the logic, you will see that this method is being called upon every question / answer pair, and we now simply need to code the action to perform:
Attach an Onclick Listener to the FAQ Entries
Because we have been so structured in our design up to this point, the action assigned to the individual questions in incredibly simple. When a given question is clicked, we simply loop over our list of all known entries and hide each of the answers - getting us back to how our page looks at initial load time. Then, once completed, we simply target the provided answer and display it to the user, since we know it is paired with the question that was clicked. This final step of the process applies the necessary user interaction to have a fully functioning FAQ page.