jqueryHow do I submit a form using jQuery?
The following example shows how to submit a form using jQuery. The example code will submit the form when the user clicks on the submit button:
$('#submit-form').on('click', function() {
$('#form-id').submit();
});
This code works by binding a click event to the submit-form element. When the user clicks on the submit-form element, the form-id form is submitted.
The code consists of the following parts:
$('#submit-form')
- This is a jQuery selector that selects the element with the id of submit-form.on('click', function() {
- This binds a click event to the submit-form element$('#form-id')
- This is a jQuery selector that selects the element with the id of form-id.submit()
- This submits the form-id form
For more information, see the jQuery documentation.
More of Jquery
- How do I use jQuery ZTree to create a hierarchical tree structure?
- How do I use jQuery to zoom an image when it is clicked?
- How can I get the y position of an element using jQuery?
- How can I use JQuery with Yii2?
- How do I use the jQuery prop() method?
- How do I use jQuery to zip files?
- How do I create a jQuery Yes/No dialog?
- How can I use jQuery to zoom an image when the user hovers over it?
- How do I use jQuery to change the z-index of an element?
- How do I use jQuery to zoom in or out on an element?
See more codes...