I have a resource file :
<web-resource key="dropdown-2-resources" name="dropdownPlugin Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="dropdownPlugin.css" location="/css/dropdownPlugin.css"/> <resource type="download" name="dropdownPlugin.js" location="/js/dropdownPlugin.js"/> <resource type="download" name="images/" location="/images"/> <context>context.for.editing.dropdowns</context> </web-resource>
and then I use:
in the .vm file at the top.
(I’ve tried making the call at the end of the file as well, makes no difference)
However, all functions that depend on document.querySelectorAll(“.classname”) don’t work because the script is loaded before the html/css is, so the array returned from the query is of course empty.
In standard html/css/js one would put
<script src="/js/dropdownPlugin.js" defer></script>
in the html to load the JS after the html
Beyond putting the script inline with the html, (bad coding practice) how do I defer the loading of the .js file until after the html/css is loaded?