js form on submit code example
Example 1: 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 2: how to submit a form in js
document.forms["myform"].submit();