jquery parent and sibling element lookup introduction

Source: Internet
Author: User

The parent and sibling lookup in the use of the process is very frequent, the following for you to introduce how jquery is implemented, interested friends can refer to the following:

Jquery.parent (expr) to find a Father node, you can pass in expr for filtering, such as $ ("span"). Parent () or $ ("span"). Parent (". Class").

Jquery.parents (expr), similar to jquery.parents (expr), but finds all ancestor elements, not limited to the parent element.

Jquery.children (expr). Returns all child nodes, this method only returns a direct child node and does not return all descendant nodes.

Jquery.contents (), returns all of the following, including nodes and text. The difference between this method and children () is that including blank text is also returned as a jquery object, and children () returns only the node.

Jquery.prev (), returns the previous sibling node, not all sibling nodes.

Jquery.prevall (), returning all previous sibling nodes.

Jquery.next (), returns the next sibling node, not all sibling nodes.

Jquery.nextall (), returns all the sibling nodes that follow.

Jquery.siblings (), returns the sibling node, not before or after.

Jquery.find (expr) is completely different from jquery.filter (expr). Jquery.filter () is filtered from the initial set of JQuery objects, and the returned result of Jquery.find () does not have the contents of the initial collection, such as $ ("P"), Find ("span"), which is the start of the element, equivalent to $ ("p Span ").

jquery parent and sibling element lookup introduction

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.