Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLFormElement
  4. submit()

HTMLFormElement: submit() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨July 2015⁩.

TheHTMLFormElement.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:

TheHTMLFormElement.requestSubmit() method is identical to activating aform's submit<button> and does not have these differences.

A form control (such as a submit button) with aname orid ofsubmit will mask the form'ssubmit method. Trying to callmyForm.submit(); throws an error "submit is not a function" because in this casesubmit refers to the form control which has aname orid ofsubmit.

<input> with attribute type="submit" will not be submitted with theform when usingHTMLFormElement.submit(), but it would besubmitted when you do it with original HTML form submit.

Syntax

js
submit()

Parameters

None.

Return value

None (undefined).

Examples

js
document.forms["my-form"].submit();

Specifications

Specification
HTML
# dom-form-submit-dev

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp