(?...Using a plugin) Installing the jQuery directory in NodeBB
-
I wrote a script based on the jQuery directory, when I run it through the console it works, but when I insert it through js / html customized in ACP it does not work, probably due to a lack of the jQuery library. Is there a way to load the jQuery directory into the NodeBB itself? By sample plugin? After all, NodeBB runs on Node.js ... Thank you!
-
@phenomlab Do you mean such a thing in custom html after a script tag with the code itself or load my code in custom js in ACP?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> </script>
-
The NodeBB client already has jQuery, which is why it worked when you ran it in the console. You don't need to include your own jQuery.
What do you mean by "it does not work"? Is there an error? How and where did you add it in the ACP?
-
NodeBB already loads jquery it's inside nodebb.min.js. So you don't have to load it again with a script tag.
The reason it works in the browser console is because it is already loaded when you run it. If you put it in custom header in the ACP it will try to run it before jquery is loaded. You should put it in custom JS tab which gets executed after nodebb.min.js is loaded.
-
-
-
@josef again, what do you mean by "does not work". Are there any errors in the js console in your browser? Did you make sure that the custom js is enabled in the ACP?
-