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 zip files?
- How do I use jQuery to detect window resize events?
- How do I use jQuery to zoom in or out on an element?
- How do I download a zip file using jQuery?
- How can I use JQuery with Yii2?
- How can I get the y position of an element using jQuery?
- How can I use jQuery to check if an element is visible?
- How do I use a jQuery UI Slider?
- How do I use jQuery with Yarn?
See more codes...