Jquery obtains the object positioning sub-Object

Source: Internet
Author: User

Special characters selected:

# ID
. Indicates class
* Select all
, Select multiple
Space descendant
> Sub-
~ Brother
+ Next
: Sub-function)
() Functional filtering and searching

Get all the title objects under the DIV: $ ("Div: Header ")CopyCodeThe Code is as follows: <body>
<H3> AAA <P> BBB </P>
<H4> CCC </H4>
<Div>
<H3> DDD <P> EEE </P>
<H4> fff </H4>
</Div>
</Body>

Get all title objects: $ (": Header ")Copy codeThe Code is as follows: <body>
<H3> AAA <P> BBB </P>
<H4> CCC </H4>
<Div>
<H3> DDD <P> EEE </P>
<H4> fff </H4>
</Div>
</Body>

get first, for example, $ ("Li: First") or $ ("Li "). first () or $ ("Ul: First") or $ ("Ul Li: First") copy Code the code is as follows:


  • AAA

  • BBB

  • CCC

  • DDD

  • EEE

  • fff

  • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    get the first of each group, for example, $ ("Li: First-Child"), $ ("Ul Li: First-Child"), or $ ("Ul: first-Child ") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    get the last, for example, $ ("Li: Last") or $ ("Li "). last () or $ ("Ul: Last") or $ ("Ul Li: Last") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    get the last of each group, for example, $ ("Li: Last-Child"), $ ("Ul Li: Last-Child"), or $ ("Ul: last-Child ") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain the nth number, for example, (obtain the third and start with 0 eq): $ ("Li: eq (2)") or $ ("Li "). eq (2) copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain the number after the first digit, for example, (if the number after the third digit is obtained, the value of GT starts from 0): $ ("Li: GT (2 )") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain the first few items, for example, (the value starting from 0 before the third item is obtained): $ ("Li: Lt (2 )") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain an even number of index values, for example, (0 for even): $ ("Li: Even") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    the retrieved index value is odd, for example, (odd starts from 0): $ ("Li: odd") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain the even number of each group, for example, (Nth-child is 1): $ ("Li: Nth-child (even)") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain the odd number of each group, for example, (Nth-child starts with 1): $ ("Li: Nth-child (ODD)") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    obtain the number of each group, for example, 2nd (starting with Nth-child): $ ("Li: Nth-child (2 )") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    use an expression to indicate the number of each group. For example, (Nth-child is 1): $ ("Li: Nth-child (3n-1 )") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    if it is a unique child element in the parent element, for example, $ ("Li: Only-Child") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    : Not indicates the inverse of other options, for example, $ ("Li: Not (Li: First-child)") copy Code the code is as follows:


    • AAA

    • BBB

    • CCC

    • DDD

    • EEE

    • fff

    • ggg


  • 111



    • XXX

    • YYY

    • ZZZ

    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.