vanilla js prevent form submit code example
Example 1: jquery prevent form submit
//option A
$("form").submit(function(e){
e.preventDefault();
});
Example 2: 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 3: javascript prevent form submit
<form name="foo" onsubmit="return false">