Several examples of jQuery

Source: Internet
Author: User

Select box
Get the id as checkAll add Click Event and change all within the time: the checkbox attribute checked is true;
Get the checkNo add click event as the id, and change all in the event: the checkbox attribute checked is false;
Get the id to add a click event for checkAga. Use the each () event to traverse the entries in checkbox [name = items] and change the checked attribute! (This) "attr (" checked ");


· Simplified display list
First, control the display index greater than 2 and remove the li label of the last entry to hide;
Add a toggle event to "show all brands" <span>. The first function displays all li. show () and changes the text of span ("simplified display ");
The second function repeatedly hides all li addresses greater than 2 and removes the last entry, and re-text the span tag ("Show All Brands ");

· Tab
First, add the mouseenter mouse to the li tag, get this, add attributes (selected class), and siblings (li ). removeClass ("selected class name"), to control the color of the selected li only
Step 2 control all child elements of the content display box children (). eq ($ (li ). index (this )). fadeIn (), and make all siblings (). hide ().

· Form Verification
Obtain all input tags named require and add a star to the strong tag!
Step 2 when the selected element loses focus, add a blur event;
Third, judge when $ (this) in the blur event function ). is ("# username"); when $ (this ). is ("# email") for email verification;
When the user name is verified, when this. value. length <6 is judged, a span label of the error message text is added to the parent element of the selected element, and vice versa;
During email verification, the span tag is cleared based on the class attribute created when the span tag is created, and a reg verification variable is created. The test () method of reg is called to verify the selected $ email. val (). when the verification value is false, create the error prompt span tag and add it to the parent element of the currently selected element! And vice versa!

 

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.