On the mail pset the inbox page loads as default whenever the DOM is loaded. Whenever I submit my form to send an email the DOM is reloaded and inbox pops up. I'm trying to get the sent mailbox to pop up but can't because the page reloads every form submission taking me to inbox. I'm using document.querySelector().onsubmit = function () {...}

Does anyone have any tips to stop the form from reloading the page on after submitting it?

1 Answer 1


sir just use event.preventdefault() as shown in image

forms have a default of submission, if not specified destination , then to the link from which the get request(meaning from location, from where form came) . so just do event.preventdefault

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .