diff --git a/scp/js/scp.js b/scp/js/scp.js
index 7d2bc0190705016e99efa4ddd18d8d35af5331db..a47af3361a58e9d5f04bdee2eb5d8aa629b982c3 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -970,7 +970,7 @@ $.changeHash = function(hash, quiet) {
 
 // Forms — submit, stay on same tab
 $(document).on('submit', 'form', function() {
-    if ($(this).attr('action').indexOf('#') == -1)
+    if (!!$(this).attr('action') && $(this).attr('action').indexOf('#') == -1)
         $(this).attr('action', $(this).attr('action') + window.location.hash);
 });