How to Use jQuery's end () method _ jquery

Source: Internet
Author: User
This article will share with you the definition, usage, and examples of end () in jQuery. It is very simple and practical. If you need it, you can refer to it. End () method definition and usage:

The end () method can return to the last "destructive" operation to change the list of matched elements to the previous state.
If no destructive operation is performed, an empty set is returned.
Destructive operation: any operation that changes the matching element. This concept may be vague. For example:

$("li").css("color","red");

The CSS function of the above code is not a destructive operation, because the Matching Element list does not change, and the CSS attribute of the text content in the element is changed.

$("li").find(".first")

The above code is a destructive operation because the list of matching elements has changed. For example, if there are three li elements, the list of matching elements has three elements, but the find () after filtering by method, the matching element list has only one element, which is a "destructive" operation.
Syntax structure:

$(selector).end()

Instance code:

 Foot home
Related Article

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.