HTMLFormElement.submit()

The HTMLFormElement.submit() method submits the form. This method does something similar to activating a submit button of the form.

The form's onsubmit event handler (for example, onsubmit="return false;") will not be triggered when invoking this method from Gecko-based applications. In general, it is not guaranteed to be invoked by HTML user agents.

Reference: http://lists.w3.org/Archives/Public/www-dom/2012JanMar/0011.html

If a form control (such as a submit button) has a name or id of submit it will mask the form's submit method.

Syntax

JavaScript
HTMLFormElement.submit()

Example

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

Specification

DOM Level 2 HTML: submit

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/htmlformelement/submit

API HTML DOM HTMLFormElement Method NeedsBrowserCompatibility NeedsMarkupWork NeedsSpecTable Reference Référence