To disable form auto submit on button click with JavaScript, we return false in the form submit event handler.
For instance, we write
myForm.onsubmit = () => {
// ...
return false;
};
to set the myForm.onsubmit property to a function that returns false to prevent the default form submission behavior.