How do I call JQuery inside library.js

  • When I'm trying to run a JQuery function in my code that's inside my library.js file I get:
    "ReferenceError: $ is not defined"

    However, it works just fine inside /static/lib/main.js,
    I'm using quickstart as the base, so I just tested to see if JQuery would run in the $(document).ready function that was already there.

    How are these two different?
    As far as I can tell, main.js doesn't include or define JQuery anywhere, is it because the library.js file gets loaded before JQuery, and main.js getting loaded later?
    I'm not too used to writing javascript/nodestuff, however, this is the last missing brick in my plugin.

  • Admin

    library.js? That's server-side, isn't it? You won't be able to use jQuery on the server-side... unless I'm misunderstanding your question?

  • library.js is server-side java script, not jQuery. jQuery functionallity can be simulated with eg cheerio
    main.js is included in HTML (client-side), here u can use jQuery.



Looks like your connection to NodeBB was lost, please wait while we try to reconnect.