Drupal – Add Extra jQuery Library

Next: Drupal 7 – Add the latest jQuery on your Drupal 7 without conflicts

The jQuery Update module allows us to update the Drupal 6 core jQuery to 1.3.2. This is definitely not enough for many 3rd party jQuery libraries. If you want to add the latest jQuery without affecting the core script, you can try the following approach which makes use of the jQuery.noConflict() and it is originally written by gala4th in his blog THERE IS NO PLACE LIKE

Ok, now we want to add the new jQuery for a specific content. Let’s follow the custom module we created in


In the preprocess function, we added the new jQuery library.

 * Implementation of theme_eureka().
function ykyuen_preprocess_eureka($variables) {
  // Extra jQuery
  $new_jquery  = '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>';
  $new_jquery .= '<script type="text/javascript">';
  $new_jquery .= '  var $j = jQuery.noConflict();';
  $new_jquery .= '</script>';
  $variables['extra'] = "Hello World!";


And now we can use the jQuery 1.6.4 in the eureka.tpl.php.

<h2>Theme .tpl.php example</h2>
<p><a href="<?php print $link; ?>"><?php print $name; ?></a></p>
<p><?php print $extra; ?></p>
<script type="text/javascript">
  var text = '$()  version  :' + $().jquery + '\r\n';
  text += '$j() version  :' + $j().jquery;


Check it out.


Done =)

Reference: THERE IS NO PLACE LIKE – Upgrade Using Newer Versions of jQuery with Drupal 6


One thought on “Drupal – Add Extra jQuery Library”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s