From fe07147d6c9b5d34eba04b36d99a7e6611673c72 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 12 Dec 2022 15:10:52 -0800 Subject: [PATCH] try event.preventDefault fix --- login.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/login.js b/login.js index 881e4a9..730e97b 100644 --- a/login.js +++ b/login.js @@ -4,10 +4,11 @@ window.addEventListener("DOMContentLoaded", init); function init (){ let formSubmitButton = document.querySelector("#submit"); - formSubmitButton.addEventListener("click", loginFormSubmitHandler); + formSubmitButton.addEventListener("click", loginFormSubmitHandler(e)); } -async function loginFormSubmitHandler () { +async function loginFormSubmitHandler (e) { + e.preventDefault(); let form = document.querySelector("form"); let formData = new FormData(form); try {