Adding jquery.validate.js using require.js generates error

Viewed 21

I need to add form validation using jquery.validate.js. When I try to use required.js to add the script I get an error message.

The code I am using to try and add the script is:

requirejs.config({
    paths: {
        "@@azure/msal-browser": "lib/msal/msal-browser.2.14.2.min",
        "js-cookie": "lib/jscookie/js-cookie.3.0.1.min",
        "bootbox": "lib/bootbox/bootbox.min",
        "jquery": "lib/jquery/dist/jquery.min.placeholder",
        "jquery_validate": "lib/jquery-validation/dist/jquery.validate.min",
    },
    shim: {
        "jquery_validate": ["jquery"],
    }
});

The error message is:

jquery.validate.min.js:4 Uncaught TypeError: Cannot read properties of undefined (reading 'extend') at jquery.validate.min.js:4:174 at Object.execCb (require.2.3.6.min.js:5:16727) at e.check (require.2.3.6.min.js:5:10499) at e.enable (require.2.3.6.min.js:5:13242) at e.init (require.2.3.6.min.js:5:9605) at a (require.2.3.6.min.js:5:8305) at Object.completeLoad (require.2.3.6.min.js:5:15962) at HTMLScriptElement.onScriptLoad (require.2.3.6.min.js:5:16882)

Thanks

0 Answers
Related