Why can't you run a server on your development machine and debug it there? Also, "it doesn't work" gives us nothing to help you - post the output of the browser console. It may well include error messages.
BTW, jQuery 3.3.1 doesn't exist, so make sure you're using the right version.
You are saying that you have code that works locally and in jsfiddle. Tim and I have both asked you what the error was in production where the code doesn't work. Go into a browser in production and look what the scripting error console says there.