So consider this problem. Let’s say you are constructing a menu and you need to set up some onclick events for the items in the menu.
...
So this is how one might set things up from first principles:
...
For some other good ideas on how to solve this problem.
This video also touches on the concept of NodeList objects.