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 Element |
.Class.Class |
$ (". Intro. demo ") |
All class = "intro" and class = "demo" Elements |
|
|
|
: First |
$ ("P: first ") |
First Element |
: Last |
$ ("P: last ") |
Last Element |
: Even |
$ ("Tr: even ") |
All even numbers |
Element
: Odd |
$ ("Tr: odd ") |
All odd |
Element
: Next |
$ ('. Item'). next ('P ') |
Class is the next p sibling element of item, equivalent to $ ('. item + p ') |
: Prev |
$ ('. Item'). prev ('P ') |
Class is the last p sibling element of item. |
: NextAll |
$ ('. Item'). nextAll ('P ') |
Class is all p sibling elements after item, equivalent to $ ('. inside ~ P ') |
: Parent> child |
$ ('P> span ') |
Select the first generation span element under p, 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) |
$ ("P: contains ('www .phpernote.com ')") |
All p 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 Element |
: 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 ") |
AllElement |
: Text |
$ (": Text ") |
All types = "text"Element |
: Password |
$ (": Password ") |
All types = "password"Element |
: Radio |
$ (": Radio ") |
All types = "radio"Element |
: Checkbox |
$ (": Checkbox ") |
All types = "checkbox"Element |
: Submit |
$ (": Submit ") |
All types = "submit"Element |
: Reset |
$ (": Reset ") |
All types = "reset"Element |
: Button |
$ (": Button ") |
All types = "button"Element |
: Image |
$ (": Image ") |
All types = "image"Element |
: File |
$ (": File ") |
All types = "file"Element |
|
|
|
: Enabled |
$ (": Enabled ") |
All activated input Elements |
: Disabled |
$ (": Disabled ") |
All disabled input Elements |
: Selected |
$ (": Selected ") |
All selected input Elements |
: Checked |
$ (": Checked ") |
All selected input Elements |