diff --git a/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js
index 08a68d2..9b41bfa 100644
--- a/core/modules/toolbar/js/toolbar.js
+++ b/core/modules/toolbar/js/toolbar.js
@@ -46,8 +46,10 @@ var mql = {
 Drupal.behaviors.toolbar = {
   attach: function(context) {
     var options = $.extend(this.options, drupalSettings.toolbar);
-    $toolbar = $(context).find('#toolbar-administration').once('toolbar');
-    if ($toolbar.length) {
+    var $newToolbar = $(context).find('#toolbar-administration').once('toolbar');
+    if ($newToolbar.length) {
+      // Update the global variable.
+      $toolbar = $newToolbar;
       // Add subtrees.
       // @todo Optimize this to delay adding each subtree to the DOM until it is
       //   needed; however, take into account screen readers for determining
