What does jquery form validation need to do _jquery

Source: Internet
Author: User
Tags jquery form validation

A Blur event occurs when the element loses focus.

Example: JQuery blur () method
Add function to blur event. Blur event occurs when <input> field loses focus:

$ ("input"). blur (function () {
alert ("This input field has lost it focus.");
});

Definitions and usage
The Blur event occurs when the element loses focus.
The blur () method triggers the Blur event, or a function that runs when the blur event occurs.
Tip: This method is often used in conjunction with the focus () method.
Grammar
to trigger the Blur event for the selected element:

 
 

Add function to blur event:

$ (selector). blur (function)

The event that triggers when the input box gets the focus.

Example: JQuery focus () method
Add function to focus event. Focus event occurs when the <input> field is focused:

$ ("input"). focus (function () {
$ ("span"). CSS ("display", "inline"). fadeout;

Definitions and usage
The focus event occurs when the element is focused (when the selected element is clicked through the mouse or when the element is positioned through the TAB key).
The focus () method triggers the focus event, or the function that runs when the focus event occurs.
Tip: This method is usually used in conjunction with the blur () method.
Grammar
Focus event that triggers the selected element:

$ (selector). Focus ()

Add function to focus event:

$ (selector). focus (function)

Third, the KeyUp event occurs when the keyboard key is released

Example: JQuery KeyUp () method
When the keyboard key is loosened, set the background color of the <input> field:

$ ("input"). KeyUp (function () {
$ ("input"). CSS ("Background-color", "pink");

Definitions and usage
Sequence of events related to the KeyUp event:

    • KeyDown-Key Press process
    • KeyPress-the key is pressed
    • KeyUp-Key is loosened

The KeyUp event occurs when the keyboard key is released.
The KeyUp () method triggers the KeyUp event, or a function that runs when the KeyUp event occurs.
Tip: Please use the Event.which property to return which key is pressed.
Grammar
KeyUp event that triggers the selected element:

 
 

Add function to KeyUp event:

$ (selector). KeyUp (function)

Iv. events that are triggered when the form is submitted

Example: JQuery Submit () method
When submitting a form, a warning box is displayed:

$ ("form"). Submit (function () {
alert ("submitted");
});

Definitions and usage
The Submit event occurs when the form is submitted.
This event applies only to <form> elements.
The submit () method triggers a Submit event, or a function that runs when a submit event occurs.
Grammar
to trigger a submit event for the selected element:

$ (selector). Submit () 

Add function to submit event:

$ (selector). Submit (function)

That's the four things you need to do with jquery form validation, and hopefully you'll have a good look at the techniques of jquery form validation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.