简体   繁体   中英

How to update jQuery in drupal7

I'm trying to update my drupal jquery1.4 to jquery1.8. I tried by using following way.

  function oxavd_js_alter(&$javascript) {
  //We define the path of our new jquery core file
  //assuming we are using the minified version 1.8
  $jquery_path = drupal_get_path('theme','oxavd') . '/js/jquery-1.8.0.min.js';

 //We duplicate the important information from the Drupal one
 $javascript[$jquery_path] = $javascript['misc/jquery.js'];
 //..and we update the information that we care about
 $javascript[$jquery_path]['version'] = '1.8.0';
 $javascript[$jquery_path]['data'] = $jquery_path;

 //Then we remove the Drupal core version
 unset($javascript['misc/jquery.js']);
}

I referred this from here

But this wasn't worked for me. It shows version 1.4.4

<script type="text/javascript" src=".../misc/jquery.js?v=1.4.4"></script>

Any help would be appreciated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM