how to load a java script into a page?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- lorenzo55@lorenzocorrea
lorenzo55 - 0 likes
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- lorenzo55@lorenzocorrea
lorenzo55 - 0 likes
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 0 likes
- iionly@iionly
iionly - 0 likes
You must log in to post replies.http://learn.elgg.org/en/2.3/guides/javascript.html
I did so but it did not work?
elgg_require_js("modifica/script");
modifica is my plugin, the js file is inside my plugin in the page default / views
In this case your JS must be saved as:
Check the browser's errors (web console).
no errors in web console.
try flushing the cache and run an upgrade.
When using elgg_require_js() the scipt you want to load must be an AMD module. Is this the case? Read the docs to find out what might be wrong in your case. Or you can study the code of some existing plugins that make use of elgg_require_js() to see how it is done.
The problem is that "it did not work" can be for different reasons. And without knowing at least what might be logged in the error log or what error might occur in the browser webconsole it's quite impossible to give you an advice what to fix.