# Drupal – Use a different jQuery version for the frontend and backend

> On Drupal frontend I want the latest jQuery especially because bootstrap require at least jQuery 1.7. Drupal 7 come with jQuery 1.4 and it’s not going to be updated. The module jQuery Update take \[…\]

Source: https://antistatique.net/en/blog/drupal-use-a-different-jquery-version-for-the-frontend-and-backend

Category: Development

# Drupal – Use a different jQuery version for the frontend and backend

Author(s)

[

![Simon](https://images.statique.ch/t/w_750,h_750,c_fill,f_jpeg,q_70/assets/avatar.png)



](#)

[Simon](#)4 January 2013

On [Drupal](http://drupal.org/) frontend I want the latest jQuery especially because [bootstrap](http://twitter.github.com/bootstrap/) require at least jQuery 1.7. Drupal 7 come with jQuery 1.4 and it’s not going to be updated.

The module jQuery Update take care of updating jQuery to a newer version. I even use the dev version so I can have jQuery 1.8. Sadly this creates some bugs in the admin. To avoid conflict I decided to load a different jQuery version for the backend and the frontend.

To do that you have to create a very small module with this code:

`/** * Implements hook_module_implements_alter(). */ function mymodule_module_implements_alter(&$implementations, $hook) { if ($hook == 'library_alter') { if(isset($implementations['jquery_update'])) { // Move jquery update to the end. This will make sure our hook_library_alter // is always called before the jquery_update. $jquery_update = $implementations['jquery_update']; unset($implementations['jquery_update']); $implementations['jquery_update'] = $jquery_update; } } }`

`/** * Implements hook_library_alter(). */ function mymodule_library_alter(&$libraries, $module) { // If it is the admin theme all we want to do is change the global $conf // variable so when jquery_update runs right after us it will use 1.5. // We are not using path_is_admin(current_path()) because some admin path can use // the frontend theme like node edit page global $theme_key; if (variable_get('admin_theme') == $theme_key) { // Modifying global $conf variable, can be dangerous. Be carefull. global $conf; $conf['jquery_update_jquery_version'] = '1.5'; } }`

I also write some patches to try to solve the compatibility problem in jQuery and in core but I prefer to stay safe for now until it’s fixed. If you want to know more about the issue check out http://drupal.org/node/1498858.

On [Drupal](http://drupal.org/) frontend I want the latest jQuery especially because [bootstrap](http://twitter.github.com/bootstrap/) require at least jQuery 1.7. Drupal 7 come with jQuery 1.4 and it’s not going to be updated.

The module [jQuery Update](http://drupal.org/project/jquery_update) take care of updating jQuery to a newer version. I even use the dev version so I can have jQuery 1.8. Sadly this creates some bugs in the admin. To avoid conflict I decided to load a different jQuery version for the backend and the frontend.

To do that you have to create a very small module with this code:

`/** * Implements hook_module_implements_alter(). */ function mymodule_module_implements_alter(&$implementations, $hook) { if ($hook == 'library_alter') { if(isset($implementations['jquery_update'])) { // Move jquery update to the end. This will make sure our hook_library_alter // is always called before the jquery_update. $jquery_update = $implementations['jquery_update']; unset($implementations['jquery_update']); $implementations['jquery_update'] = $jquery_update; } } }`

`/** * Implements hook_library_alter(). */ function mymodule_library_alter(&$libraries, $module) { // If it is the admin theme all we want to do is change the global $conf // variable so when jquery_update runs right after us it will use 1.5. // We are not using path_is_admin(current_path()) because some admin path can use // the frontend theme like node edit page global $theme_key; if (variable_get('admin_theme') == $theme_key) { // Modifying global $conf variable, can be dangerous. Be carefull. global $conf; $conf['jquery_update_jquery_version'] = '1.5'; } }`

I also write some patches to try to solve the compatibility problem in jQuery and in core but I prefer to stay safe for now until it’s fixed. If you want to know more about the issue check out [http://drupal.org/node/1498858](http://drupal.org/node/1498858).

## More articles

Author(s)

[

![Anthony](https://images.statique.ch/t/w_750,h_750,c_fill,f_jpeg,q_70/wp/app/uploads/2024/11/anthony-1-300x300.png)



](/en/agence/anthony-salamone)

[Anthony](/en/agence/anthony-salamone)28 September 2026

### [Smashing Conference Freiburg 2026](/en/blog/smashing-conference-freiburg-2026)

Back in Freiburg for Smashing Conference 2026: AI and design systems, deeply technical CSS and HTML, and more human talks about teams and mindset. Here's what we took away.

Back in Freiburg for Smashing Conference 2026: AI and design systems, deeply technical CSS and HTML, and more human talks about teams and mindset. Here's what we took away.

[

![Smashing Conference Freiburg 2026 poster](https://images.statique.ch/t/w_750,h_500,c_fill,f_jpeg,q_70/assets/blog/smashing-2026.png)



](/en/blog/smashing-conference-freiburg-2026)

Author(s)

[

![Akira](https://images.statique.ch/t/w_750,h_750,c_fill,f_jpeg,q_70/wp/app/uploads/2025/03/akira-small-300x300.jpg)



](/en/agence/akira-kamata)

[Akira](/en/agence/akira-kamata)22 July 2026

### [Making of : “La nuit des Losers”](/en/blog/making-of-la-nuit-des-losers)

lanuitdeslosers.ch, built fast: paper wireframes, a bold hand-drawn identity, then Claude Code to prototype and ship. A mouse-tracking hero animation, a bowling game made of sponsor logos, and a few bugs we’re keeping.

lanuitdeslosers.ch, built fast: paper wireframes, a bold hand-drawn identity, then Claude Code to prototype and ship. A mouse-tracking hero animation, a bowling game made of sponsor logos, and a few bugs we’re keeping.

[

![Making of : “La nuit des Losers”](https://images.statique.ch/t/w_750,h_500,c_fill,f_jpeg,q_70/wp/app/uploads/2026/05/La-nuit-des-Losers-Teaser-1-768x576.png)



](/en/blog/making-of-la-nuit-des-losers)

Author(s)

[

![Pierre](https://images.statique.ch/t/w_750,h_750,c_fill,f_jpeg,q_70/wp/app/uploads/2020/12/Pierre-300x300.jpg)



](/en/agence/pierre)

[Pierre](/en/agence/pierre)7 July 2026

### [Dark mode: necessity or trend](/en/blog/dark-mode-necessity-or-trend)

Nous faisons le tri entre idées reçues, réalités techniques et bonnes pratiques de design.

Nous faisons le tri entre idées reçues, réalités techniques et bonnes pratiques de design.

[

![Dark mode: necessity or trend](https://images.statique.ch/t/w_750,h_500,c_fill,f_jpeg,q_70/wp/app/uploads/2026/07/1-768x384.png)



](/en/blog/dark-mode-necessity-or-trend)
