简体   繁体   中英

How to properly import jquery validation via npm

How do I properly import jquery validation via npm ?

( https://www.npmjs.com/package/jquery-validation ). I tried to simply put: @import jquery-validation/dist/jquery.validate.min.js to my scripts but

I got some errors in my next scripts so I just downloaded the code and imported in this way:

<script src="{{ asset('js/jquery-validation.js') }}"></script>

I would, although, prefer the import from node_modules but I did not find any guide to do it properly.

Put

const jquery-validation = require('jquery-validation');

at the top of your app.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM