Can't add custom JS to Adaptable theme, why?

Can't add custom JS to Adaptable theme, why?

by nick wilson -
Number of replies: 2

Currently using the Adaptable theme.

I'm going to site admin/appearance/themes/adaptable/custom css & js... and trying to add JS to the form field but every time I do, the JS appears at the bottom of the site in plain text form. 

Why is this?

Can I add jQuery to this instead of plain JS? Is there a way to add jQuery without having an external file linked to the theme?

Average of ratings: -
In reply to nick wilson

Re: Can't add custom JS to Adaptable theme, why?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Are you putting the JS within 'script' tags?  As the Adaptable setting states that it is for adding Google analytics etc. and that is encompassed within html.

jQuery should already be loaded, if not then don't add it in via that mechanism as a standard script CDN line as very bad with the possibility of having two versions loaded when visiting a page that does load it properly.  See: https://docs.moodle.org/dev/jQuery and use the 'require' function within a script tag.

Additionally, please do consider posting in more targeted forums for a faster response.  Such as the 'Themes' forum.

In reply to Gareth J Barnard

Re: Can't add custom JS to Adaptable theme, why?

by nick wilson -

That's a good idea. I will try the script tags when I get back to that project later today and let you know how it goes! thanks