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 can I get the y position of an element using jQuery?
- How can I use JQuery with Yii2?
- How do I use the jQuery masked input plugin?
- How do I uncheck a checkbox using jQuery?
- How can I convert jQuery code to vanilla JavaScript?
- How can I convert XML data to JSON using jQuery?
- How can I use jQuery to control the visibility of an element?
- How do I use the jQuery UI Datepicker?
- How do I use jQuery to trigger an event?
- How do I use jQuery to toggle an element?
See more codes...