jquery Learning notes the use of the jquery selector _jquery

Source: Internet
Author: User
Tags prev

A. Basic selector:

    • #id: Select the element for the given ID name, such as: $ ("#id1") to select an element with an ID of ID1
    • . class: Select the element for the given class name
    • Element: Selects all primary colors for a given element name
    • *: Match all elements
    • Selector1,selector2,......: Select the elements of these names, separated by commas, can be class or ID names

Two. Hierarchy selector:

    • $ ("ancestor descendant"): Selects all descendant (descendant) elements under the ancestor element
    • $ ("Parent>child"): Select All Child (sub) elements under parent
    • $ (' Prev+next '): Select the first next element immediately following Prev
    • $ (' prev~siblings '): Select all siblings elements after Prev

$ (' Prev+next ') and $ (. prev). Next ("Next") function as

$ (' prev~siblings ') and $ (. prev). Nextall ("siblings") function as

Three. Filter selection:

    • : First select the element such as: $ ("Div:first") to select the first DIV element
    • : Last Select Final element
    • : Not (selector) Select elements that are not selector
    • : Even select an even index element
    • : Odd Select all odd-indexed elements
    • : EQ (Index) to select an element that is equal to index
    • : GT (Index) Select an element that is greater than index
    • : LT (index) Select element with index less than index
    • : Header Select all <H> elements
    • : animanted Select all animation elements

Four. Content Filter:

    • : Contains (text) Select elements containing text text such as: $ ("div:contains (' Hello ')") to select a DIV element containing the Hello character
    • : Empty selects all elements that do not contain characters
    • : Has (selector) Select elements that contain selector elements
    • : Parent selects elements that contain child elements

Five. Visibility filtering:

    • : Hidden Select all visible elements
    • : Visible Select all invisible elements

Six. Attribute filter:

    • [attribute] Select the element that owns this property, such as $ ("div[id]") to select the div element that contains the id attribute
    • [Attribute=value] Select an element with attribute property equal to value
    • [Attribute!=value] Select elements that attribute attributes are not equal to value values
    • [Attribute^=value] Select an element with attribute property equal to value
    • [Attribute$=value] Select an element with an attribute property value starting at value
    • [Attribute*=value] Select an element with an attribute property value containing the value
    • [Selector1] [Selector2] .... Elements (combinations) that meet these conditions

Seven. child element Filter Selector

    • : Nth-child (index/even/odd/eqation) Select the index/even/odd child element under the parent element
    • : First-child Select the first child element of the parent element
    • : Last-child Select the last child element of the parent element
    • : Only-child Select a unique child element under the parent element

Eight. Form Property Filtering

    • : Enabled Select all visible elements such as: $ ("#form1: Enabled") is all available elements that select the form ID as Form1
    • : Disable Select all invisible elements
    • : Checked Select all selected elements
    • : Selected Select All selected option elements

Nine. Form Object filter

    • :input  Select all <input><textarea><select><button> elements
    • : Text to select all Single-line text sections, The following are all in this format
    • : Password
    • : Radio
    • : CheckBox
    • : Submit
    • : Image
    • : res ET
    • : Button
    • : File
    • : Hidden
       

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.