preventdefault on form submit code example
Example 1: js stop form submit
<button type="submit" onclick="submitButtonClick(event)">Submit</button>
<script>
function submitButtonClick(event) {
event.preventDefault();
//other stuff you want to do instead...
}
</script>
Example 2: prevent button from submitting form
function myFunc(e){
e.preventDefault();
}
Example 3: prevent button form submit
<button type="button">Button</button>