Form onsubmit Event
Form Object
Definition and Usage
The onsubmit event is called when the form is submitted.
Syntax
onsubmit="
JavaScriptCode
"
| Parameters | Description |
|---|---|
| JavaScriptCode | Required. Specifies the JavaScript code to be executed after the event is triggered. |
Browser support





All major browsers support the onsubmit event
Example
Example
Display an alert box after the submit button is clicked to submit the form:
What is your name?
Try it »
Form Object