jQuery Event - submit() Method
Example
Display a warning box when the form is submitted:
$("form").submit(function(e){ alert("Submitted"); });
Definition and Usage
A submit event occurs when a form is submitted.
This event is only applicable to form elements.
The submit() method triggers the submit event or specifies a function to be executed when a submit event occurs.
Bind a function to the submit event
Syntax
$(selector).submit(function)
Parameters | Description |
---|---|
function | Optional. Specifies a function to be executed when a submit event occurs. |
More examples
- Prevent the default action of the submit button
- Use the preventDefault() function to prevent the submission of a form.