This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The HTMLFormElement.submit() method submits a given <form>.
This method is similar, but not identical to, activating a form's submit <button>. When invoking this method directly, however:
submit event is raised. In particular, the form's onsubmit event handler is not run.The HTMLFormElement.requestSubmit() method is identical to activating a form's submit <button> and does not have these differences.
A form control (such as a submit button) with a name or id of submit will mask the form's submit method. Trying to call myForm.submit(); throws an error "submit is not a function" because in this case submit refers to the form control which has a name or id of submit.
<input> with attribute type="submit" will not be submitted with the form when using HTMLFormElement.submit(), but it would be submitted when you do it with original HTML form submit.
submit()
None.
None (undefined).
document.forms["my-form"].submit();
| Specification |
|---|
| HTML> # dom-form-submit-dev> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
submit |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit