First, the basic selector
1.ID Selector $ ("#id")
2. Class Selector $ (". Class")
3. Element selector $ ("element")
4. Wildcard Selector $ ("*")
5. Collection Selector $ ("#id, P,span")
Second, level selector
1.$ ("ancestor descendant") selects all descendant (descendant) elements in the ancestor element
2.$ ("Parent>child") selects the child element under the parent element, which differs from the descendant element in that the descendant elements include child elements, grandson elements, and heavy grandson elements.
3.$ ("Prev+next") is equivalent to $ ("prev"). Next ("Next") selects the next element immediately following the Prev element
4.$ ("Prev~siblings") is equivalent to $ ("prev"). Nextall () selects all prev elements after the siblings element for all subsequent sibling nodes
Third, filter selector
1. Basic Filter Selector
: First selects the 1th element
: Last element selected
: Not (selector) $ ("Input:not (. myClass)") Select all <input> elements of class that are not MyClass
: Even $ ("Input:even") Select index is even <input> element index starting from 0
: Odd index is an odd number of all elements, starting from 0
: EQ (index) selects an element that is equal to index (index starts at 0)
: GT (Index) index is larger than index element (index starting from 0)
: LT (index) index the element of the Light Rain Index (index starting from 0)
: Header selects all header elements, such as H1,H2, etc.
: Animated selects all elements that are currently performing an animation
2. Content Filter Selector
: Contains (text) Select the element containing the text content as "text"
: Empty selects null elements that do not contain child elements or text
: Has (selector) selects the element that contains the element that the selector matches
:p arent Select elements that contain child elements or text
3. Visibility Filter Selector
: Hidden Select all invisible Elements $ (": hidden") including <input type= "hidden"/> <div style= "display:none;" ><div style= "Visibility:hidden" >
: Visible Select all visible elements $ ("div:visible") Select all visible div
4. Attribute Filter Selector
[Attribute] $ ("div[id]") Select the element that owns the property ID
[Attribute=value] $ ("div[title=test]") Select the <div> element with the property title "Test"
[Attribute!=value] $ ("div[title!=test]") Select the attribute title is not a "test" <div> element, no Title property will also be selected
[Attribute^=value] $ ("div[title^=test]") Pick property title div element starting with "test"
[Attribute$=value] $ ("div[title$=test]") Pick property title div element ending with "test"
[Attribute*=value] $ ("div[title*=test]") pick attribute title The div element containing "test"
[Selector1] [Selector2] [Selectorn] $ ("div[id][title$= ' Test ']") Select the div element that owns the property ID, and the property title ends with "test"
5. Child element Filter Selector
: Nth-child (index/even/odd/equation): eq (index) matches only one element, while: Nth-child Jiang Wei each parent element matches a child element, and: Nth-child (Index) The index is calculated starting from 1 and: EQ (index) starts at 0
: First-child the 1th child element of each parent element
: Last-child the last child element of each parent element
: Only-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
jquery selector (top)