1.jQuery Basic selector:
#id: Match an element by ID
. Class: Based on the given class match element
element: matching elements according to tags
*: Match all elements
Selector1,selector2: Returns the element that each selector matches to
2. Hierarchy Selector
$ ("ancestor descendant"): Select descendant element under ancestor
$ ("Parent>chid"): Select parent under child element
$ ("Prev+next"): Selects the next element immediately following the Prev element, which can be replaced with $ (". One"). Next ("div").
$ ("prev~siblings"): Selects all siblings elements after the Prev element and can be replaced with $ (". One"). Nextall ("div").
3. Filter Selector
$ (: first): SELECT element One
$ (: last): Select the final element
$ (: header): Select all heading elements
$ (: Animated): Selects all elements that are currently performing an animation
$ (: Focus): Select the element that currently gets focus
$ (: Contains (text)): Content Filter Selector, select all text that contains text
$ (: Empty): Select an element that does not contain child elements or that text is empty
$ (: Has (selector)): Select the element that contains the selector match element
$ (:p arent): Select an element that contains child elements or text
$ (: visible): Selects all visible elements
$ (: Hidden): Select all hidden elements
Attribute Filter Selector:
[Attribute]: Select the element that owns the property, such as [ID], which is the collection of elements that have an attribute ID
[Attribute:value]: Select an element with a property value of
: Nth-child (): Select the corresponding child element, such as Nth-child (2) to select an element with an index value of 2 (index from 1)
Form Object selector:
: Enabled: Select all available elements
:d isables: Select all elements that are not available
: Checked: Selects all selected elements, Radio box and check box
: Selected: Select All selected elements, drop-down list
: input: Select all <input> collection elements
: Radio: Select all the Radio boxes
Example:
Select a specific table to make it discolored:
$ ("#tb tbody tr:even"): Select the ID of TB, and then look for the tbody tag, the TR index is even selected.
When you get an object element in jquery, there are no spaces that are not the same
var $t _a=$ ('. Test:hidden ') Select the hidden element in the element with class test
var $t _b=$ ('. Test:hidden ') Select the hidden class test element
jquery Learning Notes