We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49407
    • 159 Posts
    I've added an awesome dashboard widget to send out emails for the inviteMe plugin I wrote.

    I want to use some jQuery to make it more interactive.

    I'm getting the famous "Uncaught ReferenceError: $ is not defined(index):931 (anonymous function)" error in my inspector and of course my jQuery calls aren't working.

    Is there an easy fix that doesn't require changes to the core files?

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You should be able to use $modx->regClientStartupScript() to load the jquery library.

      I just tested that, and it does in fact work as expected.
      $modx->regClientStartupScript(MODX_ASSETS_PATH . 'js/jquery.js');
      [ed. note: sottwell last edited this post 11 years, 9 months ago.]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 49407
        • 159 Posts
        Ok. That made the jquery in my widget work.

        However, it appears to have created these new and more troublesome errors...

         GET http://www.cannacle.com/manager/assets/ext3/resources/css/ext-all-notheme-min.css net::ERR_EMPTY_RESPONSE
        www.cannacle.com/:12 GET http://www.cannacle.com/manager/assets/ext3/ext-all.js net::ERR_EMPTY_RESPONSE
        ext-base.js:21 Uncaught TypeError: Cannot read property 'prototype' of undefined
        index.php?f=/manager/assets/modext/core/modx.localization.js,/manager/assets/modext/util/utilities.…:1 Uncaught TypeError: undefined is not a function
        index.php?f=/manager/assets/modext/widgets/core/modx.window.js,/manager/assets/modext/widgets/core/…:1 Uncaught TypeError: Cannot read property 'prototype' of undefined
        ext-base.js:21 Uncaught TypeError: Cannot read property 'prototype' of undefined
        (index):18 Uncaught TypeError: undefined is not a function
        index.php?f=/manager/assets/modext/widgets/security/modx.grid.user.recent.resource.js,/manager/asse…:1 Uncaught TypeError: Cannot set property 'RecentlyEditedResourcesByUser' of undefined
        (index):24 Uncaught TypeError: undefined is not a function
        (index):32 Uncaught TypeError: undefined is not a function
        (index):43 Uncaught TypeError: undefined is not a function
        
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Well, that I don't know. You may need to start your jquery in no-conflict mode; I don't know if Jquery conflicts with ExtJS.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
          • discuss.answer
            • 49407
            • 159 Posts
            The errors were seemingly due to a momentary collapse of my internet connection's integrity. Refreshed several times and now it's loading up error free.

            Thanks for your insight, Susan.