A detailed explanation of the end () method of JQuery

Source: Internet
Author: User
<ul class= "First" >   <li class= "foo" >list item 1</li>   <li>list Item 2</li>   <li class= "Bar" >list Item 3</li></ul><ul class= "Second" >   <li class= "foo" >list item 1</li>   <li>list Item 2</li>   <li class= "bar" >list Item 3</li></ul>$ (' Ul.first '). Find ('. Foo '). css (' background-color ', ' Red ').  end (). Find ('. Bar '). CSS (' background-color ', ' green ');

Back to a recent "destructive" operation.

This command chain retrieves the items in the first list that have the class name Foo and sets their background to red. End () Restores the object to the state before the call to find (), so the second find () looks for the '. Bar ' in <ul class= "First" > instead of <li class= "foo" > in the list and will match The background of the element is set to green. The final result is that item 1 and item 3 in the first list are set with a colored background, and the items in the second list have no changes.

  

A detailed explanation of the end () method of JQuery

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.