Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).

The submit event fires when a <form> is submitted.

Note that the submit event fires on the <form> element itself, and not on any <button> or <input type="submit"> inside it. (Forms are submitted, not buttons.)

The submit event only fires when the user clicks a submit button (<button> or <input type="submit">) in a form. The event is not raised when calling the form.submit() method directly.

Note: Trying to submit a form that does not pass validation triggers an invalid event. In this case, the validation prevents form submission, and thus there is no submit event.

General info

Interface Event
Bubbles Yes (although specified as a simple event that doesn't bubble)
Cancelable Yes
Targets Element
Default Action Varies (send the content of the form to the server)

Properties

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

Specification Status Comment
HTML Living Standard
The definition of 'submit' in that specification.
Working Draft No change
HTML 5.2
The definition of 'submit' in that specification.
Recommendation No change
HTML 5.1
The definition of 'submit' in that specification.
Recommendation No change
HTML5
The definition of 'submit' in that specification.
Recommendation Initial definition

See also

Etiquetas y colaboradores del documento

Última actualización por: mdnwebdocs-bot,