diff --git a/django/contrib/admin/static/admin/js/jquery.init.js b/django/contrib/admin/static/admin/js/jquery.init.js index 41b1051769..dd4605c368 100644 --- a/django/contrib/admin/static/admin/js/jquery.init.js +++ b/django/contrib/admin/static/admin/js/jquery.init.js @@ -1,4 +1,8 @@ -// Puts the included jQuery into our own namespace +/* Puts the included jQuery into our own namespace using noConflict and passing + * it 'true'. This ensures that the included jQuery doesn't pollute the global + * namespace (i.e. this preserves pre-existing values for both window.$ and + * window.jQuery). + */ var django = { - "jQuery": jQuery.noConflict() + "jQuery": jQuery.noConflict(true) }; diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 9c5ba2ca67..1e283151b0 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1289,10 +1289,14 @@ The :doc:`staticfiles app ` prepends definitions on forms `. Django admin Javascript makes use of the `jQuery`_ library. To avoid -conflict with user scripts, Django's jQuery is namespaced as -``django.jQuery``. If you want to use jQuery in your own admin -JavaScript without including a second copy, you can use the -``django.jQuery`` object on changelist and add/edit views. +conflicts with user-supplied scripts or libraries, Django's jQuery is +namespaced as ``django.jQuery``. If you want to use jQuery in your own admin +JavaScript without including a second copy, you can use the ``django.jQuery`` +object on changelist and add/edit views. + +If you require the jQuery library to be in the global namespace, for example +when using third-party jQuery plugins, or need a newer version of jQuery, you +will have to include your own copy of jQuery. .. _jQuery: http://jquery.com