Any form is submitted when the user click on the submit button.
But you may need to submit the form programmatically using JavaScript.
JavaScript has the form object that contains the submit() method.
Use the "ID" of the form to get the form object.
Example:
If the name of the form is "Form1", JavaScript code for the submit method is:
But you may need to submit the form programmatically using JavaScript.
JavaScript has the form object that contains the submit() method.
Use the "ID" of the form to get the form object.
Example:
If the name of the form is "Form1", JavaScript code for the submit method is:
document.forms["Form1"].submit();
Source: https://www.nilebits.com/blog/2011/01/how-to-submit-a-form-using-javascript/
No comments:
Post a Comment