12 Types of jquery selectors

Source: Internet
Author: User

12 Types of jquery selectors1, #id: Match an element according to the given ID

Display (with bold instead of color):

This is the first P tag

2, *: Matching all elements, more used in conjunction with the context to search

Show:

This is the P tag

This is the div tag.

3, Multi-selector Selector1,selector2,selectorn: Specify any number of selectors, and merge the matched elements into one result

Show:

This is the second P tag

This is the first div tag

This is a second div tag

4. Ancestor descendant: matches all descendant elements under a given ancestor element

This is the first span tag

This is the second span tag

5, Prev + Next: Matches all next elements immediately following the Prev element

6, Prev ~ siblings: All siblings sibling elements after matching the prev element

This is the third P tag

7.: First: Get the element one

8: Not (selector): Removes all elements that match the given selector

9.: even: Matches all elements with an even number of index values, starting from 0 counts

This is the P-label with an index value of 0

This is the P-label with an index value of 1

This is the P-label with an index value of 2

This is the P-label with an index value of 3

10.: Odd: Matches all elements with an odd index value, counting from 0

11,: Last (): Get final element

12: GT (Index): matches all elements greater than the given index value

12 Types of jquery selectors

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.