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 julio de 2015.
Manejador de eventos del evento submit para el objeto window.
Sintaxis
window.onsubmit = funcRef;
Parametros
funcRefes 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
Loading…