Multiple Jquery VersionMultiple Jquery Version
2016 17 Feb

Multiple Jquery Version

By Basant Sharma

Many times you need to work with more than one jquery version, especially if you are working with drupal6. Most of the funky jquery plugins doesn't work with jqeury 1.4 and below. And you can't upgrade drupal jquery to some higher version using best practices. On the other hand using hacks (changing core files) can cause problems with Drupal bootstrap, core modules, etc.

Best way to combat this situation is to use jquery noConflict() function. Add following lines to page.tpl.php above 'php print $scripts'  

 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> (replace this with the version you want to use)
<script type="text/javascript">
var $jq = jQuery.noConflict();
</script>

Then replace the $ with $jq inside the jquery files where you want to use above jquery version or simply put the content of those jquery files inside the following tags

(function($){
..
...
..

})($jq)

And that's it, in this way you can use more than one jquery version within a single drupal installation.

 

    Latest Blogs

    Chrome

    Chrome to call out websites that are ‘too slow’

    There’s little that can test your patience like a slow-loading website. Google gets that, and they’ve now got your back.

    Read More

    Significant UI

    6 Significant Reasons to Invest in UX Design

    In the digital world, we live in today building a digital presence has become important for organizations of all kinds.

    Read More

    Drupal 9

    Getting ready for Drupal 9: what should website owners do?

    Drupal 9 will release on 3rd June 2020, which means it will be the end of announcements for Drupal 7 and Drupal 8. Drupal 9 will not be much of a change from Drupal 8.

    Read More

    Security

    Tips to Secure your Drupal Website with Ease: Basic Security checklist

    If someone were to break in your room, they would probably learn less about you than if they hacked you on the internet.

    Read More