prevent page from reloading after form submit
问题 Is there a way to detect and stop if page is reloading. I have a page which is getting reloaded after successful submission of a form present in it. I want to have an event listener which sees if page is reloading and should stop it from being reloaded. I cannot return false; for sucessful submit of registration form 回答1: In your html: <form onsubmit="myFunction()"> Enter name: <input type="text"> <input type="submit"> </form> In your javascript: myFunction = function(e) { // prevents default