--- title: submit slug: Web/API/HTMLFormElement/submit_event tags: - 事件 - 表单 - 表单事件 - 表单提交事件 translation_of: Web/API/HTMLFormElement/submit_event ---

当表单提交的时候触发submit事件

注意submit事件只能作用于form元素,不能作用于button或者<input type="submit">

General info

Specification
HTML5
Interface
{{domxref("Event")}}
Bubbles
Yes (although specified as a simple event that doesn't bubble)
Cancelable
Yes
Target
Element
Default Action
Varies (send the content of the form to the server).

Properties

Property Type Description
target {{readonlyInline}} {{domxref("EventTarget")}} The event target (the topmost target in the DOM tree).
type {{readonlyInline}} {{domxref("DOMString")}} The type of event.
bubbles {{readonlyInline}} {{jsxref("Boolean")}} Whether the event normally bubbles or not.
cancelable {{readonlyInline}} {{jsxref("Boolean")}} Whether the event is cancellable or not.