How do event listeners work on conditionally rendered items?

I’m not sure why it wasn’t rendering on its own, but I used the solution in this post to resolve the issue.