diff --git a/CHANGES.md b/CHANGES.md
index f25359eb43895854a2f6e3b371a695606d25337f..9ded5a8b19f599db68ba1470a05313e942ca0721 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -4,6 +4,10 @@ moodle-theme_boost_campus
 Changes
 -------
 
+### Unreleased
+
+* 2019-11-29 - Moved the variable output.standard_end_of_body_html from footer.mustache to solve Javascript issues with behat tests.
+
 ### Release v3.7-r3
 
 * 2019-11-13 - Improved Video JS Skin for hiding big play button in audio players and removed centered placement of this button in SCSS.
diff --git a/templates/columns2.mustache b/templates/columns2.mustache
index 81075923b032495e3523cda25b1a774dcfec208a..fff505ab83c7dff43c3ea508db5473c9c2f7ae8c 100644
--- a/templates/columns2.mustache
+++ b/templates/columns2.mustache
@@ -57,6 +57,7 @@
       template and use the equivalent own javascript "incoursesettings".
     * Call to own navbar mustache template instead of boost/navbar.
     * Add own additional layout elements: the footer, footnote or image area.
+    * Moved the variable output.standard_end_of_body_html from footer.mustache to solve Javascript issues with behat tests.
 }}
 {{> theme_boost/head }}
 
@@ -107,6 +108,8 @@
     {{> theme_boost/nav-drawer }}
     {{{ pagebottomelements }}}
 </div>
+{{! Moved the variable here from footer.mustache to solve Javascript issues with behat tests. }}
+{{{ output.standard_end_of_body_html }}}
 
 </body>
 </html>
diff --git a/templates/footer.mustache b/templates/footer.mustache
index 4e096714a9ef8f8ad628ccf15f9f8f301fb056d6..ba4a2313edf74913e547be9a8f081343f261a46a 100644
--- a/templates/footer.mustache
+++ b/templates/footer.mustache
@@ -33,6 +33,9 @@
         "footerrightblocks": "<aside id='block-region-footer-right' class='block-region' data-blockregion='footer-right' data-droptarget='1'>This is the right footer region</aside>"
     }
 }}
+{{! MODIFICATION:
+    * Moved the variable output.standard_end_of_body_html to the end of the columns2.mustache template to solve Javascript issues with behat tests.
+}}
 <footer id="page-footer" class="py-3 bg-dark text-light">
     <div class="container-fluid">
         <div class="row-fluid">
@@ -103,7 +106,9 @@
                     {{/ output.custom_menu_flat }}
                 </nav>
                 {{{ output.standard_footer_html }}}
-                {{{ output.standard_end_of_body_html }}}
+                {{! Moved the variable
+                output.standard_end_of_body_html
+                to the end of the columns2.mustache template to solve Javascript issues with behat tests. }}
             </div>
         </div>
     </div>