form on submit javascript code example

Example 1: form submit programmatically

if (typeof document.getElementById('ss-form').submit === "object") {
    document.getElementById('ss-form').submit.remove();
}
document.getElementById('ss-form').submit();

Example 2: javascript submit a form

document.getElementById("myFormID").submit();

Example 3: 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 4: javascript submit form

document.forms["myform"].submit();

Tags:

Html Example