--- title: GlobalEventHandlers.onsubmit slug: Web/API/GlobalEventHandlers/onsubmit translation_of: Web/API/GlobalEventHandlers/onsubmit ---
{{ApiRef("HTML DOM")}}

Manejador de eventos del evento submit para el objeto window.

Sintaxis

window.onsubmit = funcRef;

Parametros

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 Status Comment
{{SpecName('HTML WHATWG','webappapis.html#handler-onsubmit','onsubmit')}} {{Spec2('HTML WHATWG')}}  

Browser Compatibility

{{CompatibilityTable}}
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Android Webview Chrome for Android Edge Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}