onsubmit event
Examples
Executed when the form is submitted JavaScript:
<Form onsubmit = "myFunction ()">
Enter name: <input type = "text">
<Input type = "submit">
</ Form>
Enter name: <input type = "text">
<Input type = "submit">
</ Form>
try it"
Definition and Usage and Usage
onsubmit event triggered when the form is submitted.
Browser Support
event | |||||
---|---|---|---|---|---|
onsubmit | Yes | Yes | Yes | Yes | Yes |
grammar
In HTML:
<Elementonsubmit = "myScript"> try
In JavaScript:
object .onsubmit = function () {myScript }; try
JavaScript, use the addEventListener () method:
object .addEventListener ( "submit", myScript ); try
Note: Internet Explorer 8 and earlier versions of IE do not support addEventListener () method.
Technical Details
technical details
Whether to support the bubble: | Yes |
---|---|
It can be canceled: | No |
Event Type: | Event |
Supported HTML tags: | <Form>, <keygen> |