Multiple Jquery VersionMultiple Jquery Version
2016 17 Feb

Multiple Jquery Version

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

Digital Public Goods Alliance Strategy 2021–2026

Boosting Digital Infrastructure with Digital Public Goods

The United Nations (UN) defines a roadmap for Digital Public Goods (DPGs) as open-source software, open data, open AI models, open standards, and open content.

Read More

Best Practices for Software Testing

Power of Software Testing: Why Software Teams Use It Effectively

In the modern digital era, where software is used in nearly every aspect of everyday life, the importance of software testing cannot be emphasized.

Read More

Benefits of Programmatic SEO Implementation

What It Is and How to Implement It How SEOs Make the Web Better

In the rapidly evolving field of SEO, staying ahead of the curve necessitates adopting new strategies and utilizing technology.

Read More

Unlocking the potential of SEO for boosting business

Branding With SEO: Boost brand Visibility, credibility, and Engagement With An SEO Strategy

Many people think that the primary function of search engine optimization is to garner organic traffic on a website; however, it is beyond that.

Read More