Hi Guys

As you know if you updated jquery for whole drupal then drupal core jquery not work as you expect. To prevent this issue we can update jquery for the specific pages or theme . Just download jquery_update module and place it to appropriate module directory then put this code into your theme template.php

function [YOURTHEME_NAME]_library_alter(&$javascript, $module) { 
  if ($module != 'system') {
    return;
  }
  if([YOUR_CONDITION_STATEMENT]){
    $path = drupal_get_path('module', 'jquery_update');
    $javascript['jquery']['version'] = '1.7.1';
    $javascript['jquery']['js']['misc/jquery.js']['data'] = $path . '/replace/jquery/1.7/jquery' . '.min' . '.js';
      // Replace the jQuery Cookie plugin.
    $javascript['cookie']['js']['misc/jquery.cookie.js']['data'] = $path . '/replace/ui/external/jquery.cookie.js';
    // Noting the version based on git commit as no version number is available.
    $javascript['cookie']['version'] = '67fb34f6a866c40d0570';

    // Replace jQuery Form plugin.
    $javascript['jquery.form']['js']['misc/jquery.form.js']['data'] = $path . '/replace/misc/jquery.form' . $min . '.js';
    $javascript['jquery.form']['version'] = '2.69';

    $javascript['drupal.states']['js']['misc/states.js']['data'] = $path . '/replace/misc/1.7/states.js';
  }
}  

Above code is for jquery 1.7.
Thanks

Comments

ericduran’s picture

Status: Active » Closed (works as designed)