My Script Doesn't Work
The simplest way to check is to set up a minimal web page and paste the script into that to see if it will work there. If the script works in the minimal page then you can slowly add sections of code to slowly convert it back to the full page testing as you go to see which piece of the rest of the page it is that is breaking the script. If the script doesn't work in a minimal web page then you know that it is the script itself that is broken.
So what exactly is a minimal web page? It is a web page with the minimum of content needed to actually be a web page in the first place. The code for our minimal web page lo0oks like this:
All you need to do with the minimal web page is to save it as test.html and paste your script into it following the instructions on how to install the script into a web page. This basically gives us a web page which contains effectively nothing except the script that doesn't work when added to your regular web page. Since the rest of your web page isn't in this test.html file if the script doesn't work when pasted into this page you know that the problem is either something in the script itself or that you are adding it into the wrong place in the page. If it does work in the test.html page then you know that the script is failing because of a conflict with something else in the page.
Either way you have reduced where you need to look to find out what is causing the problem.