submit()
MethodYou 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>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Django 3 CRUD Tutorial Example with MySQL and Bootstrap
Django 3 is released with full async sup...How to Configure Nodemon to Auto-reload Node App
In this Node.js tutorial, I will tell yo...Laravel 8 Send Mail using Mailtrap
Today, I would relish to show you larave...Laravel 8 Add Facebook Like and Share Post Button Tutorial
Facebook is one of the best source to re...HTML Country Select Dropdown List
You might need an select drop-down list...