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

HTMLFormElement.submit()

Example

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

Specification

DOM Level 2 HTML: submit

Document Tags and Contributors

 Last updated by: teoli,