I'm trying to run a basic JavaScript function from an external file but I'm getting inconsistent results. Basically, I can't get a button's "onclick" event to fire when I put the script in an external JS page. I can get it work in CodePen:
nonsense code
but NOT in JSFiddle:
I can always get it work when the script is part of the HTML page but I don't want to do that. Can you help? Thanks!