We have a Drupal 7 website, which is using an old version of jquery by default.But we need to write a custom module which uses some features only present in latest jquery.
We use a module called jqmulti to include multiple jquery simultaneously. You can install this by reading installation instructions at jqmulti page.Make sure you copied the jquery version you want to libraries folder as listed in instructions.
But it makes available only the existing jquery by default. For code present in libraries folder, we can provide new jquery by going to admin/config/system/jqmulti and enabling the required libraries.
- On admin/config/system/jqmulti, check Always load this
jQuery library, even if no libraries or files are targeted to it.
- On your custom code, use alias of new jquery. For example, if you
are using 1.11.2, alias will be jq1112. See an example below.
Old way: jQuery('#testdiv').collapse New way: jq1112('#testdiv').collapse
Using hooks provided by jqmulti
Use hook_jqmulti_files() for files you like to add new jquery for and
hook_jqmulti_libraries() for libraries. You can see api documentation
for more details.
If you have any other method, please let us know in comments. Thank you.