Prevent submits from reloading the page

This commit is contained in:
Frank A. Krueger 2017-07-06 14:19:06 -07:00
parent 3b83e49680
commit 4d70553afa
1 changed files with 3 additions and 2 deletions

View File

@ -90,7 +90,7 @@ function msgListen (m) {
return; return;
} }
if (debug) console.log ("Listen", node, m.k); if (debug) console.log ("Listen", node, m.k);
node.addEventListener(m.k, function () { node.addEventListener(m.k, function (e) {
const em = { const em = {
m: "event", m: "event",
id: m.id, id: m.id,
@ -104,7 +104,8 @@ function msgListen (m) {
const ems = JSON.stringify (em); const ems = JSON.stringify (em);
socket.send (ems); socket.send (ems);
if (debug) console.log ("Event", em); if (debug) console.log ("Event", em);
return true; if (em.k === "submit")
e.preventDefault ();
}); });
} }