HTMLFormElement.submit() - Web APIs 编辑
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:
- No
submit
event is raised. In particular, the form'sonsubmit
event handler is not run. - Constraint validation is not triggered.
The HTMLFormElement.requestSubmit()
method is identical to activating a form's submit <button>
and does not have these differences.
If a form control (such as a submit button) has a name
or id
of submit
, this method will mask the form's submit method.
<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.
Syntax
HTMLFormElement.submit()
Example
document.forms["myform"].submit();
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'HTMLFormElement: submit' in that specification. | Living Standard |
Browser compatibility
BCD tables only load in the browser
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论