== .onSubmit ==

.onSubmit()

Attaches an event handler callback function to the “submit” event of a ''<[[mdn>Web/HTML/Element/form|form]]>'' element.
Usage:
[[mdn>Web/API/HTMLFormElement|HTMLFormElement]] = Form.''onSubmit''(callback)
Member of:
[[mdn>Web/API/HTMLFormElement|HTMLFormElement]]
Parameters:
callback – the function to call when the “submit” event occurs (required).
Returns:
The [[mdn>Web/API/HTMLFormElement|HTMLFormElement]] it was called on, thus allowing for command chaining.
Note:
This is just a shorthand function for the [[toolbox:event:on:index|.on]] method, specific for the “submit” event. See there for more information and examples.
===== See also ===== * [[toolbox:event:on:index|.on]] * [[toolbox:event:off:index|.off]] ===== More information ===== * [[mdn>Web/API/HTMLFormElement|HTMLFormElement]] on MDN.