
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 −
- Related Questions & Answers
- jQuery :submit Selector
- Can I submit form with multiple submit buttons using jQuery?
- jQuery mousedown() with Examples
- jQuery mouseup() with Examples
- jQuery slideUp() with Examples
- jQuery queue() with Examples
- jQuery delay() with Examples
- jQuery hide() with Examples
- jQuery replaceWith() with Examples
- jQuery position() with Examples
- jQuery prop() with Examples
- jQuery ready() with Examples
- jQuery replaceAll() with Examples
- jQuery load() with Examples
- jQuery removeData() with Examples
Advertisements