Javascript not loading on my deploy

Hi Folks,

Here is the link to the Netlify deploy:
And the link to my github repo: GitHub - zetaontherocks/treecounter: A counter part of scrimba javascript course

This is a build from scrimba, it worked there, it works on codepen too but for some reason it is not loading javascript here on Netlify nor on Visual Studio.

Could you assist ?

Thank you.

@zetaontherocks The issue has nothing to do with it being on Netlify.

Your issue is that Vite has gotten you to add type="module" to your script element, and thus your functions aren’t being automatically attached to the window to be triggered by your onclick attributes.

If you manually assign your functions to the window object you will find that it works.

Try adding the following to the bottom of your index.js

window.increment = increment = save
window.reset = reset
1 Like