Uncaught ReferenceError: function is not defined with onclick

Never use .onclick(), or similar attributes from a userscript! (It’s also poor practice in a regular web page). The reason is that userscripts operate in a sandbox (“isolated world”), and onclick operates in the target-page scope and cannot see any functions your script creates. Always use addEventListener()Doc (or an equivalent library function, like jQuery .on()). … Read more