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?

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');
}
| improve this answer | |
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';
  }
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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