aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static/js
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-24 10:42:18 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-24 10:42:18 +0800
commitfa1d1e5ac7a101068016296c00baa55a420f7d40 (patch)
treea15f3b06a40c48e53eae7bb45f376221ef583888 /fg21sim/webui/static/js
parenta3474a7877c4502d79d2eba65794527966197c72 (diff)
downloadfg21sim-fa1d1e5ac7a101068016296c00baa55a420f7d40.tar.bz2
webui: main.js: Prevent form submitting on "Enter" press
Diffstat (limited to 'fg21sim/webui/static/js')
-rw-r--r--fg21sim/webui/static/js/main.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/fg21sim/webui/static/js/main.js b/fg21sim/webui/static/js/main.js
index dc471dc..f0755c2 100644
--- a/fg21sim/webui/static/js/main.js
+++ b/fg21sim/webui/static/js/main.js
@@ -249,4 +249,13 @@ $(document).ready(function () {
var body = toggle.closest(".panel").find(".panel-body");
toggleBlock(toggle, body);
});
+
+ // Prevent from submitting form by "Enter"
+ // Credit; https://stackoverflow.com/a/11235672/4856091
+ $("form").on("keypress", function (e) {
+ if (e.which === 13) {
+ e.preventDefault();
+ return false;
+ }
+ });
});