- jQuery Examples
- Examples - Home
- Examples - Set up
- Examples - Selectors
- Examples - Attributes
- Examples - Traversing
- Examples - CSS
- Examples - DOM
- Examples - Events
- jQuery Useful Resources
- jQuery - Quick Guide
- jQuery - Useful Resources
jQuery Examples - submit( )
Description
The submit() method triggers the submit event of each matched element.
Syntax
Here is the simple syntax to use this method −
selector.submit()
Parameters
None
Example
Following is a simple example showing the usage of this method. Here it triggers the submit event of each matched element −
<html> <head> <title>The jQuery Example</title> <script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> </head> <body> <form id = "sampleForm"> <input type = "submit" value = "Submit"/> <input type = "button" value = "Trigger Submit" onclick="triggerSubmit();"/> </form> <script type = "text/javascript" language = "javascript"> function triggerSubmit(){ $("#sampleForm").submit(); } $("#sampleForm").submit(function( event ) { alert("Handler for submit() called!"); }); </script> </body> </html>
This will produce following result −
jqueryexamples_events.htm
Advertisements
To Continue Learning Please Login
Login with Google