Adding custom js file to a quiz

Re: Adding custom js file to a quiz

by Daniel Thies -
Number of replies: 0
Picture of Core developers Picture of Plugin developers Picture of Testers
Hello Helgus,

I think you may be conflating some of the documentation. There are several different methods for including js on a moodle page. The $THEME->javascript reference is an older method for adding some js to all pages and running it globally. The code which you have written appears to be an AMD module definition. This is a much more modern method described in Javascript modules. You could put your example definition in theme/classic/amd/src and include it on a page by one of the methods in the documentation. However, I think it will work as you have it if you change define to require in your current code.