I. Basic Selector
The basic selector is the most commonly used selector for jquery, and is the simplest selector to find DOM elements by element ID, class tag name (only once in a Web page, ID is unique, but class allows reuse)
1.id Selector
Usage: $ ("#id名称"); Returns a collection of the constituent elements of a single element
2.class (class selector)
Usage: $ (". Class"); Returns the collection element class is the style name
3.element (Tag Selector)
Usage: $ ("Span,p,div"); Returning a collection element
4.* All selectors
Usage: $ ("*"); Returns a collection element that matches all elements
Two. Hierarchy Selector
Base Filter Selector (also the most commonly used filter selector)
: Not (SELECT) Usage: $ (input:not (select)); Returns the collection element description: Removes all elements that match the given selector. It's kind of like "non."
: First finds element one
: last element found
: Odd matches the element labeled base
: Even matches an even-numbered element
: eq (subscript) matches the element that made the subscript
: GT (Subscript) match index value is greater than the element to be set (not including itself)
: The LT (subscript) match index value is less than the element of the given small label (does not contain itself)
Content Filter Selector
: Contains ("text content") matches whether the element contains the text content of the specified text
: Has (tag element) matches the element that contains the element that the selector matches
: Empty matches element content to null element
:p arent matches elements that contain child elements or text
Attribute Filter Selector
[Attribute=value]: The property filter Selector is the element's properties to get the corresponding element
For example: $ ("Input[name= ' chk ']"). attr ("Checked", true); Is the checked of the check box named Chk returns a collection property changed to True
Visibility Filter Selector
: Hidden Filters hidden Elements (type= "hidden", css:display= "name")
: Visible Filter Elements
child element Filter Selector
: Nth-child (index/even/odd/equation) Note: The index value here starts at 1, and the EQ is starting from 0
: First-child Find First child element
: Last-child found last child element
: Only-child matches elements with only one child element
Form object property Filter Selector
:d isabled filtering for elements that are not available
: Enabled filters available elements
: Checked Filter selected check box
: Selected filter drop-down box selected element
jquery Chapter II Selector