Why does my code work in Codepen but not anywhere else?

Codepen: https://codepen.io/Que_Tran000/pen/zbNYRQ?editors=1000

Netlify: https://hopeful-meitner-7c6ebe.netlify.com/

Try taking your script out of the head element and place it on the last line inside the body right before the closing tag.

1 Like