html form on submit code example
Example 1: html submit button
<input type="submit" value="Submit">
Example 2: html submit form onclick
var form = document.getElementById("form-id");
document.getElementById("your-id").addEventListener("click", function () {
form.submit();
});
Example 3: how to run js before submit html
<form onsubmit="return do_something()">
function do_something(){
return true;
return false;
}
Example 4: javascript submit form
document.forms["myform"].submit();
Example 5: submit html
<input type="submit">
Example 6: how to use form on submit in html
<form onsubmit="myFunction()">
Enter name: <input type="text">
<input type="submit">
</form>