Drupal 8 use its own jquery version by default and if you want to use the other version of jQuery instead of default than this tutorials steps is for you, sometimes we need different version to other plugins and libraries to work if you are using external libraries or something like that . Follow the steps
1) we need to create the "libraries-override" attribute in yourtheme.info.yml
libraries-override:
core/jquery: yourtheme/jquery-custom
2) Second download and placed your js file in theme folder like example:
"[drupalroot]/themes/custom/yourtheme/js/jquery-2.2.0.min.js"
Path should be like above path and placed it
3) Now update your yourtheme.libraries.yml with this code and replace name of your js
jquery-custom:
js:
assets/js/jquery-2.2.0.min.js: { weight: -20 }
Please note I used weight to load it above, because according to my example jquery is required many places, so it loads first, you can set according to your need.
Hope its helps
- Log in to post comments