GlobalEventHandlers.onsubmit

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.

Manejador de eventos del evento submit para el objeto window.

Sintaxis

window.onsubmit = funcRef;

Parametros

  • funcRef es una referencia a una función.

Ejemplo

<html>
<script>
function reg() {
  window.captureEvents(Event.SUBMIT);
  window.onsubmit = hit;
}

function hit() {
  console.log('hit');
}
</script>

<body onload="reg();">
<form>
  <input type="submit" value="submit" />
</form>
<div id="d"> </div>
</body>
</html>

Notas

El evento submit se genera cuando el usuario hace click en el boton submit en un formulario (<input type="submit"/>).

El evento submit no se genera cuando el usuario llama a la función form.submit() directamente.

Especificaciones

Specification
HTML
# event-submit
HTML
# handler-onsubmit

Browser Compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
submit event

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support