--- title: GlobalEventHandlers.onsubmit slug: Web/API/GlobalEventHandlers/onsubmit translation_of: Web/API/GlobalEventHandlers/onsubmit ---
Manejador de eventos del evento submit para el objeto window.
window.onsubmit = funcRef;
funcRef
es una referencia a una función.<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>
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.
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG','webappapis.html#handler-onsubmit','onsubmit')}} | {{Spec2('HTML WHATWG')}} |
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}} |