prevent button from submitting form javascript code example
Example 1: javascript prevent form submit
<form name="foo" onsubmit="return false">
Example 2: prevent button from submitting form
function myFunc(e){
e.preventDefault();
}
<form name="foo" onsubmit="return false">
function myFunc(e){
e.preventDefault();
}