![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery submit() with Examples
The submit() method in jQuery is used to trigger the submit event. It occurs when a form is submitted.
Syntax
The syntax is as follows −
$(selector).submit(func)
Above, the func parameter is the function to run when the submit event is triggered
Example
Let us now see an example to implement the jQuery submit() method −
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function() { $("form").submit(function(){ alert("Form Submitted"); }); }); </script> </head> <body> <h2>Login<h2> <form action=""> Enter Username: <input type="text"><br> Enter Password: <input type="password"><br> <input type="submit" value="Submit"> </form> </body> </html>
Output
This will produce the following output−
Click the “Submit” button −
Advertisements