How to use the submit method in jquery
This article mainly introduces the relevant knowledge of "how to use the submit method in jquery". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use the submit method in jquery" can help you solve the problem.
In jquery, the submit method is a method that triggers a form event; it can trigger a submit event or specify a function that runs when a submit event occurs, and the submit event occurs when the form is submitted, with the syntax "element object .submit (function)".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
Submit method in jquery
The submit event occurs when the form is submitted.
This event applies only to elements.
The submit () method triggers the submit event, or specifies the function to run when the submit event occurs.
The submit event that triggers the selected element:
(selector) .submit ()
Add a function to the submit event:
$(selector) .submit (function)
Function is optional. Specifies the function to run when the submit event is triggered.
Examples are as follows:
(document) .ready (function () {$("form") .submit (function () {alert ("submit");}); First name:
Last name:
Output result:
After clicking the button:
This is the end of the introduction to "how to use the submit method in jquery". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.