Hi, I have this JS function which allows me to filter my projects for example when u press on all it shows u all my projects and when u press on apps it filters down my projects to only show apps etc.
Whenever I run my code with this function on my local device it works well, the same when I upload it to GitHub pages but whenever it’s published to netlify, it doesn’t work. And I’m still new to JS and I can’t figure out what the problem is.
I tried putting the function on its own file, I tried placing the script in the HTML document along with the projects, and whenever I use type=‘module’ on the file it doesn’t work. Can someone please help me figure out why the filter doesn’t work.
@Govan This issue isn’t Netlify specific, you’ll see the same thing if you run npm run build locally, go into the dist folder then serve it with npx serve.
When clicking the buttons in your UI the error shown in the console is:
Those buttons are using the onclick attribute to try and trigger the function filterObjects: