How do I call JQuery inside library.js

Plugin Development
  • #1

    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.

  • GNU/Linux

    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?

  • #3

    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.

Suggested Topics

  • Error when importing library

    Unsolved Plugin Development
    0 Votes
    7 Posts

  • Accesing JQuery in widget template

    Unsolved Plugin Development
    0 Votes
    2 Posts

  • 0 Votes
    2 Posts

  • 0 Votes
    3 Posts

  • 0 Votes
    2 Posts

| | | |