Multiple jquery
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.

 

    Featured blog

    web-personalization

    Personalized Content is a Proven Entity !!

    Irrespective of how big a business icon or brand you are, increasing the relevance of your website will always be critical to your success.

    Read More

    Git Hooks

    Git hooks for better codes

    We are programmers and we are always on the lookout for ways to improve our code. A good and structured way of coding defines the completeness of a programmer.

    Read More

    Drupal ,varnish cache

    Hard time with Drupal, Varnish Cache and Cookies

    Using a reverse proxy server in front of a web server is usually needed for every big site and it is a very good thing to do so as reverse proxy server will handle all the anonymous traff

    Read More

    Say no to captcha

    Say no to captcha - Various Spam Protection Methods

    Maintaining high traffic websites have their own merits and demerits, the most annoying thing about them is SPAM.

    Read More