child element selectors in the jquery selector

Source: Internet
Author: User

Sub-element filter selectors are not often used, its filtering rules than other selectors slightly more complex point, in fact, Bo master feeling is not very difficult, because the word so easy, haha.

Let's see what we have here:

Note :
1.: First matches only one individual element, but: the First-child selector can match multiple: that is, each parent element is matched to the primary child element. This is equivalent to: nth-child (1)
2.:last matches only a single element: The Last-child selector can match multiple elements: that is, the last child element is matched for each parent element
3. If the child element has only one word: First-child and: Last-child is the same
4.: Only-child matches an element that is the only child element in the parent element, meaning that the current child element is the only element in the parent element, the match
5.jQuery implementation: Nth-child (n) is strictly from the CSS specification, so the N value is "index", that is, starting from 1 to Count -child (index) starting from 1, and the EQ (index) is starting from 0
The difference between 6.nth-child (n) and: Nth-last-child (n) is calculated from the previous, and the latter is from the back forward.

<! DOCTYPE html>  

The

example is here to make a good experience of yo.

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.