before submit js code example
Example 1: buttons js before submit
$('#myform').submit(function() {
// DO STUFF...
return true; // return false to cancel form action
});
Example 2: how to run js before submit html
<form onsubmit="return do_something()">
function do_something(){
// Do your stuff here
return true; // submit the form
return false; // don't submit the form
}
Example 3: buttons js before submit
<form id="myform">
...
</form>