4

I have installed the jQuery Update module and set jQuery 1.10 as default jQuery version, but one of my previous functionality stop working.

I just want to use jQuery 1.8 for a specific page. How can I achieve this?

1

2 Answers 2

6

Add your condition to remove jquery 1.10 :

function THEME_js_alter(&$javascript) {
if ($your_condition) {
    $path = drupal_get_path('module', 'jquery_update') . '/replace/jquery/1.10/jquery.min.js';
    unset($javascript[$path]);
    drupal_add_js('path/to/jquery1.8');
}
2
4

You can use hook_js_alter to add, remove JS files and change the source of existing JS files.

Something like this should work:

function hook_js_alter(&$javascript) {
  if (arg(0) == 'special-page') {
    javascript['misc/jquery.js']['data'] = 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';
  }
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.