diff --git a/hypha/static_src/src/javascript/main-top.js b/hypha/static_src/src/javascript/main-top.js
new file mode 100644
index 0000000000000000000000000000000000000000..eea775eb08e7cfaaaccac25a321f987057e96b72
--- /dev/null
+++ b/hypha/static_src/src/javascript/main-top.js
@@ -0,0 +1,10 @@
+(function ($) {
+
+    'use strict';
+
+    // IE 11 does not support classList.replace.
+    // document.querySelector('html').classList.replace('no-js', 'js');
+    $('html').removeClass('no-js').addClass('js');
+
+
+})(jQuery);
diff --git a/hypha/static_src/src/javascript/main.js b/hypha/static_src/src/javascript/main.js
index 24cb650e55ade0c84814c1f24d0f945a2e4723bc..f69750f07fe906436cad234de5c82a6284da73ec 100644
--- a/hypha/static_src/src/javascript/main.js
+++ b/hypha/static_src/src/javascript/main.js
@@ -2,10 +2,6 @@
 
     'use strict';
 
-    // IE 11 does not support classList.replace.
-    // document.querySelector('html').classList.replace('no-js', 'js');
-    $('html').removeClass('no-js').addClass('js');
-
     let Search = class {
         static selector() {
             return '.js-search-toggle';
diff --git a/hypha/templates/base-apply.html b/hypha/templates/base-apply.html
index f1515e0355c6f43fa369116149a02289623d9415..e5d04583a5ba5b2a95e43a0322e77fa5088452bd 100644
--- a/hypha/templates/base-apply.html
+++ b/hypha/templates/base-apply.html
@@ -33,7 +33,7 @@
 
         <script src="{% static 'js/jquery.min.js' %}"></script>
         <script src="{% static 'js/js.cookie.min.js' %}"></script>
-        <script src="{% static 'js/main.js' %}"></script>
+        <script src="{% static 'js/main-top.js' %}"></script>
     </head>
 
     <body class="{% block body_class %}light-grey-bg template-{{ page.get_verbose_name|slugify }}{% endblock %}">
@@ -111,6 +111,7 @@
         </main>
 
         <footer class="footer"></footer>
+        <script src="{% static 'js/main.js' %}"></script>
         {% block extra_js %}{% endblock %}
     </body>
 </html>
diff --git a/hypha/templates/base.html b/hypha/templates/base.html
index 9315a776df8e4f1146fe015affa182a4e7e79f2e..527be9b86f99d42ee77606d461ae91353c05cccb 100644
--- a/hypha/templates/base.html
+++ b/hypha/templates/base.html
@@ -58,7 +58,7 @@
         <link rel="stylesheet" href="{% static 'css/print.css' %}" media="print">
 
         <script src="{% static 'js/jquery.min.js' %}"></script>
-        <script src="{% static 'js/main.js' %}"></script>
+        <script src="{% static 'js/main-top.js' %}"></script>
     </head>
 
     <body class="{% block body_class %}template-{{ page.get_verbose_name|slugify }}{% endblock %}">
@@ -201,6 +201,7 @@
               new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, autoDisplay: false}, 'google_translate_element');
             }
         </script>
+        <script src="{% static 'js/main.js' %}"></script>
         {% block extra_js %}{% endblock %}
     </body>
 </html>