API data displays with window load event listener but not document click listener?

Hello All,

I asked a previous question and feel I may have been unclear. I will ask in a different way here and try to be clearer and more succinct.

Does anyone know why an API request would display data properly when retrieved via a window.addEvenListener("load") but not retrieve and display data on a document."ElementToBeClicked.addEventListener("click")?

I am still learning so forgive me if I am asking something overly simple. I have been racking my brain trying to understand what I am missing.

I will add a link to a fiddle for clarification. It contains the working code and code I am trying to make work commented out.

Thanks in advance for any advice!


A post was merged into an existing topic: Retrieve and display API via event listener

I went ahead and combined your posts for you. Please use the edit button or create a reply to your existing topic instead of multi-posting next time. Thank you.