jquery Selector (iii) filter Selector

Source: Internet
Author: User

1. Basic Filter Selector

Selector Describe Return
: A Select 1th Element A single element
: Last Select the last Element A single element
: Not (selector) Removes all elements that match a given selector Collection elements
: Even Select all elements of an even number index, starting at 0 Collection elements
Dd Select the index is an odd number of all elements, the index starting from 0 Collection elements
: EQ (Index) Select the element with index equal to index (index starting from 0) A single element
: GT (Index) Select an element with index greater than index (index starting from 0) Collection elements
: LT (Index) Select an element with index less than index (index starting from 1) Collection elements
: Header Select all the header elements, such as H1,H2,H3, and so on Collection elements
: Animated Select all elements that are currently executing the animation Collection elements

2. Content Filter Selector
The filtering rules of content filter selector are mainly embodied in the resource Exchange or text content.

selector :contains (text) :has (selector) :p arent
description return
set element
:empty
collection element

3. Visibility Filter Selector
The Visibility filter selector is a more element-visible and invisible state to select the appropriate element.

Selector Describe Return
: Hidden Select all elements that are not visible Collection elements
: Visible Select all visible elements Collection elements

4. Attribute Filter Selector
The filter rule for the property filter selector is to get the corresponding element through the attributes of the element.

Selector Describe Return
[Attribute] Select the element that owns this property Collection elements
[Attribute=value] Select the element of value for the property Collection elements
[Attribute!=value] To select an element of the property that is not equal to value Collection elements
[Attribute^=value] Select the element that the value of the property starts with Collection elements
[Attribute$=value] Select the element that ends the value of the property Collection elements
[Attribute*=value] Select the element with value for the property Collection elements
[Selector1] [Selector2] [Selectorn] The property selector is merged into a composite property selector that satisfies multiple conditions. Each time you choose, narrow the range Collection elements

5. child element Filter Selector
The filtering rules of the child element filter selector are slightly more complex than the other selectors, but they are not related, as long as the element's parent and child elements are clearly differentiated, so it is easy to use.

:first -child :last-child
selector description back
:nth-child (index/even/odd/equation) set element
set element
collection element
 nly-child If an element is the only child element in its parent element, it will be matched. If the parent element contains other elements, it will not be matched

6. Form Object Properties Filter Selector
Form object property Filter Selector Filters the selected form objects primarily.

Selector Describe Return
: Enabled Select all available elements Collection elements
:d isabled Select all unavailable elements Collection elements
: Checked Select all selected elements (Radio box, check box) Collection elements
: Selected Select All selected option elements (drop down list) Collection elements

There are many types of filter selectors, and there are some small differences in the rules used, you can try to remember their characteristics.

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.