Event Onsubmit
# onsubmit Event
[ Event Object](#)
## Example
Execute JavaScript when a form is submitted:
Enter name:
[Try it Β»](#)
* * *
## Definition and Usage
The onsubmit event occurs when a form is submitted.
* * *
## Browser Support
| Event | | | | | |
| --- | --- | --- | --- | --- | --- |
| onsubmit | Yes | Yes | Yes | Yes | Yes |
* * *
## Syntax
In HTML:
(#)
In JavaScript:
_object_.onsubmit=function(){_myScript_};(#)
In JavaScript, using the addEventListener() method:
_object_.addEventListener("submit", _myScript_);(#)
**Note:** Internet Explorer 8 and earlier IE versions do not support the [addEventListener()](#) method.
* * *
## Technical Details
| Bubbling: | Yes |
| --- |
| Cancellable: | No |
| Event type: | Event |
| Supported HTML tags: | , |
* * Event Object](#)
YouTip