jquery's powerful selector---source "sharp jquery"

Source: Internet
Author: User

First, the basic selector

1, #id match an element according to the given ID

2. class matches the element according to the given class name

3, element matches elements according to the given element name

4. * Match all elements

5, Selectore1,.selectore2, #selectore3 the elements that match each selector are merged and returned together

Second, level selector

6. Ancestor descendant selects all descendant (descendants) elements in the ancestor element

7. Parent>child Select the child element under the parent element, which differs from the ancestor descendant, and ancestor descendant chooses the descendant element

8. Prev+next selects the next element immediately after the Prev element

9. Prev~siblings selects all siblings elements after the Prev element

Three, basic filter selectors

10: First SELECT element

11.: Last selected Element

12: Not (selector) removes all elements that match the given selector

13,: Even select all elements indexed to even index starting from 0

14,: Odd Select all elements indexed as odd index starting from 0

15: EQ (index) selects the element indexed as index (index starting from 0)

16: GT (Index) Select an element with index greater than index (index starting from 0)

17.: LT (index) Select an element with index less than index (index starting from 0)

18,: Header Select all the title elements, such as H1,H2,H3, etc.

19.: Animated Select the element that is currently performing the animation

Iv. Content Filter Selector

20: Contains (text) Select the element containing the text content as "text"

21.: empty element with no child elements or text selected

22,: Has (selector) Select the element that contains the element that the selector matches

23.:p Arent Select elements that contain child elements or text

V. Visibility Filter Selector

24,: Hidden Select all the invisible elements

25,: Visible Select all visible elements

Vi. Attribute Filter Selector

26. [attribute] Select the selector that owns this property

27. [Attribute=value] Select an element with the value of the attribute

28. [Attribute!=value] Select an element for which the value of the attribute is not of value

29. [Attribute^=value] Select an element with the value of the attribute starting with

30. [Attribute$=value] Select an element that ends with value

31, [Attribute*=value] The value of the selected attribute contains the element of value

32. [Selector1][selector2][selectorn] combines a property selector with a composite attribute selector that satisfies multiple conditions, one time per selection, and a narrow range

Sub-element Filter Selector

33: Nth-child (index/even/odd/equation) Select the index child element or the odd-even element under each parent element (Note: Index starts from 1)

34,: First-child Select the first child element of each parent element

35,: Last-child Select the last child element of each parent element

36,: Only-child If an element is the only child element in its parent element, it will be matched and will not be matched if the parent element contains other elements

Viii. Form object property Filter Selector

37,: Enabled Select all available elements

38. Disabled Select all unavailable elements

39,: Checked Select all selected elements (Radio box, check box)

40.: Selected Select All selected option elements (drop-down list)

Nine, form selector

41.: Input selects all <input>, <textarea>, <select> and <button> elements

42.: Text selects all the single line textbox

43,:p Assword Select all the Password box

44,: Radio Select all the Radio box

45.: CheckBox selects all multi-box

46,: Submit Select all the Submit button

47.: Image selects all images button

48.: Reset selects all reset buttons

49.: Button Selects all buttons

50,: File Select all the upload domain

jquery's powerful selector---source "sharp jquery"

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.