Filter selector for jQuery learning and jquery filter Selector

Source: Internet
Author: User

Filter selector for jQuery learning and jquery filter Selector

: First select the first element: $ ("div: first ")

: Last select the last element: $ ("div: last ")

: Not (selector) retrieves other elements except selector: $ ("div: not (. class )")

: Even: select the element with an even index: $ ("div: even ")

: Odd: elements with an odd index: $ ("div: odd ")

: Eq (index) index equals index: $ ("div: eq (1 )")

: Gt (index) index greater than index: $ ("div: gt (1 )")

: Lt (index) index less than index: $ ("div: lt (1 )")

: Select All tag elements (h1, h2, h3) for header: $ ("div: header ")

: Animated: select all the elements of the animation being executed: $ ("div: animated ")

 

Content Filter Selector

: Contain (text): $ ("div: contain ('Hello World ')")

: Empty: select an empty element that does not contain child elements or text: $ ("div: empty ")

: Has (selector) selects the element containing the element matched by the selector: $ ("div: has (p )")

: Parent: select an element that contains child elements or text: $ ("div: parent ")

 

Visibility filter Selector

: Hidden selects invisible elements

: Visible: Select visible elements

 

Attribute filter Selector

[Attribute] select the element that owns this attribute: $ ("div [align]")

[Attribute = value] elements whose property value is selected: $ ("div [align = center]")

[Attribute! = Value] Select an element whose property value is not value: $ ("div [align! = Center] ")

[Attribute ^ = value] Select an element whose attribute value starts with value: $ ("div [align ^ = center]")

[Attribute $ = value] select the element whose attribute value ends with value: $ ("div [align $ = center]")

[Attribute * = value]: $ ("div [align * = c]")

[Attribute] [attribute] [attribute] the selector merged with the attribute selector: $ ("div [align * = c] [id] [class]")

 

Child element filter Selector

: Nth-child (index/even/odd/equation) Select the index element under each parent element (starting from 1)

: First-child: select the first child element of each parent element.

: Last-child selects the last child element of each parent element.

: Only-child matches the child element of the parent element with only one child element.

 

Form object attribute filter Selector

: Enabled: select all available elements

: Disabled: select all unavailable Elements

: Checked select all selected elements (single checked, check box)

: Selected select all selected elements (drop-down list)

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.