How to import jquery-validation?

Hi,

I’m trying to use jquery validation from NPM package but not succeeding in imporint it.

How is the correct syntax for importing it?
I’m trying import jquery-validation from 'jquery-validation'; but its not working.

jquery-validation isn’t a valid Javascript variable name.

Try something like import jQueryValidation from 'jquery-validation';

1 Like

It’s still not working, console.log($.validate) is returning undefined. How actually is this validate suppose to be attached to jQuery anyway?

Got it to work like this:import jqueryValidation from 'jquery-validation';

How would I know which is the correct variable name to import though? Should I read the npm package file? I can’t find this variable anywhere in the package source code.

2 Likes