WEB TUTORIALS
PRACTICE EXAMPLES
HTML REFERENCES
CSS REFERENCES
PHP REFERENCES

How to Submit a Form Using jQuery

Topic: JavaScript / jQueryPrev|Next

Answer: Use the jQuery submit() Method

You can use the submit() method to submit an HTML form (i.e. <form>) using jQuery.

The jQuery code in the following example will submit the form on click of the button (i.e. the <button> element) which has the type attribute set to button (i.e. type="button").

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  • <meta charset="utf-8">
  • <title>jQuery Form Submit</title>
  • <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  • <script>
  • $(document).ready(function(){
  •     $("#submitBtn").click(function(){        
  •         $("#myForm").submit(); // Submit the form
  •     });
  • });
  • </script>
  • </head>
  • <body>
  •     <form action="action.php" method="post" id="myForm">
  •         <label>First Name:</label>
  •         <input type="text" name="first-name">
  •         <button type="button" id="submitBtn">Submit Form</button>
  •     </form>
  • </body>
  • </html>

Related FAQ

Here are some more FAQ related to this topic:

Your Feedback:

We would love to hear from you, please drop us a line.