📜  防止在 onsubmit 函数调用上提交表单 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:16.948000             🧑  作者: Mango

代码示例1
returning false here won't be executed and the form will be submitted either way. You should also call preventDefault to prevent the default form action for Ajax form submissions.

function mySubmitFunction(e) {
  e.preventDefault();
  someBug();
  return false;
}

Get more references : https://stackoverflow.com/questions/3350247/how-to-prevent-form-from-being-submitted