The HTMLFormElement.submit()
method submits the form. This method does something similar to activating a submit button of the form.
When invoking this method directly, no submit event is raised (in particular, the form's onsubmit
event handler is not run), and constraint validation is not triggered either.
If a form control (such as a submit button) has a name or id of submit
it will mask the form's submit method.
HTMLFormElement.submit()
document.forms["myform"].submit()
HTML Living standard: The form element
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | Yes | Yes | Yes | Yes | Yes |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit