submit

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.

io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/zh-tw/web/api/htmlformelement/index.md)

submit 事件會在表單送出時觸發。

要注意的是,submit 事件只會form element 上觸發, button 或是 submit input 則不會觸發。(送出的是「表單」,而非「按鈕」)

基本資料

定義規範

HTML5

Interface
Event
Bubbles

是 雖說在規範上這是個不 bubble 的事件

Cancelable

Target

Element

默認行動

修改(傳送表單內容至伺服器)。

屬性

Property Type Description
target Read only EventTarget The event target (the topmost target in the DOM tree).
type Read only DOMString The type of event.
bubbles Read only Boolean Whether the event normally bubbles or not.
cancelable Read only Boolean Whether the event is cancellable or not.

規範

Specification
HTML Standard
# event-submit
HTML Standard
# handler-onsubmit