Selector |
Instance |
Select |
* |
$ ("# Item *") |
Select all the elements under item as the id attribute. |
#Id |
$ ("# Lastname ") |
Id = "lastname" element |
.Class |
$ (". Intro ") |
All class = "intro" Elements |
Element |
$ ("P ") |
All <p> Elements |
.Class.Class |
$ (". Intro. demo ") |
All class = "intro" and class = "demo" Elements |
|
|
|
: First |
$ ("P: first ") |
First <p> element |
: Last |
$ ("P: last ") |
Last <p> element |
: Even |
$ ("Tr: even ") |
All even <tr> Elements |
: Odd |
$ ("Tr: odd ") |
All odd <tr> Elements |
: Next |
$ ('. Item'). next ('div ') |
Class is the next div sibling element of item, equivalent to $ ('. item + div ') |
: Prev |
$ ('. Item'). prev ('div ') |
Class is the last div sibling element of item. |
: NextAll |
$ ('. Item'). nextAll ('div ') |
Class is all div sibling elements after item, equivalent to $ ('. inside ~ Div ') |
: Parent> child |
$ ('Div> span ') |
Select the first generation span element under the div, also known as the immediate child element |
: Parent |
$ ('. Item: parent ') |
Select the parent element of the element whose class is item |
|
|
|
: Eq (Index) |
$ ("Ul li: eq (3 )") |
The fourth element in the list (index starts from 0) |
: Gt (No) |
$ ("Ul li: gt (3 )") |
List elements with an index greater than 3 |
: Lt (No) |
$ ("Ul li: lt (3 )") |
List elements whose index is less than 3 |
: Not (Selector) |
$ ("Input: not (: empty)") $ ("input: not (. must )") |
All input elements not empty; all elements whose class attributes are not must |
|
|
|
: Header |
$ (": Header ") |
All title elements |
: Animated |
|
All animation Elements |
|
|
|
: Contains (Text) |
$ ("Div: contains ('www .phpernote.com ')") |
All div elements include all elements of the www.phpernote.com string |
: Empty |
$ (". Item: empty ") |
All elements of the element whose class attribute is item without child (element) nodes |
: Hidden |
$ ("P: hidden ") |
All hidden <p> Elements |
: Has |
$ ('. Item: has (span )') |
All the elements whose class attribute is item contain all the elements of span (whether or not they are directly in the System) |
: Visible |
$ ("Table: visible ") |
All visible tables |
|
|
|
S1, s2, s3 |
$ ("Th, td,. intro ") |
All elements with matching Selection |
|
|
|
[Attribute] |
$ ("A [href]") |
All a tag elements with href attributes |
[Attribute=Value] |
$ ("[Href = '#']") |
The value of all href attributes is equal to the "#" element. |
[Attribute! =Value] |
$ ("[Href! = '#'] ") |
The values of all href attributes are not equal to "#" elements. |
[Attribute$ =Value] |
$ ("Your href00000000'.jpg ']") |
The values of all href attributes contain elements ending with ". jpg ". |
|
|
|
: Input |
$ (": Input ") |
All <input> Elements |
: Text |
$ (": Text ") |
All <input> elements of type = "text" |
: Password |
$ (": Password ") |
All <input> elements of type = "password" |
: Radio |
$ (": Radio ") |
All <input> elements of type = "radio" |
: Checkbox |
$ (": Checkbox ") |
All <input> elements of type = "checkbox" |
: Submit |
$ (": Submit ") |
All <input> elements of type = "submit" |
: Reset |
$ (": Reset ") |
All <input> elements of type = "reset" |
: Button |
$ (": Button ") |
All <input> elements of type = "button" |
: Image |
$ (": Image ") |
All <input> elements of type = "image" |
: File |
$ (": File ") |
All <input> elements of type = "file" |
|
|
|
: Enabled |
$ (": Enabled ") |
All activated input Elements |
: Disabled |
$ (": Disabled ") |
All disabled input Elements |
: Selected |
$ (": Selected ") |
All selected input Elements |
: Checked |
$ (": Checked ") |
All selected input Elements |