selector |
instance |
Select |
* |
$ ("#item *") |
Select the id attribute to all elements under item |
#ID |
$ ("#lastname") |
id= elements of "LastName" |
. class |
$ (". Intro") |
All elements of the class= "Intro" |
Element |
$ ("P") |
All <p> elements |
. class. class |
$ (". Intro.demo") |
All class= "Intro" and Class= "demo" Elements |
|
|
|
: A |
$ ("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 for item, equivalent to $ ('. Item + div ') |
:p Rev |
$ ('. Item '). prev (' div ') |
Class is the last div sibling element for item |
: Nextall |
$ ('. Item '). Nextall (' div ') |
Class is all the div sibling elements after item, equivalent to $ ('. Inside ~ Div ') |
:p arent > Child |
$ (' div > span ') |
Select the first generation span element under the Div, also known as the direct child element |
:p arent |
$ ('. Item:parent ') |
Select the parent element of the element with class as item |
|
|
|
: eq (index) |
$ ("UL Li:eq (3)") |
Fourth element in the list (index starting from 0) |
: GT (no) |
$ ("UL li:gt (3)") |
List elements with index greater than 3 |
: LT (no) |
$ ("UL Li:lt (3)") |
List elements with index less than 3 |
: Not (selector) |
$ ("Input:not (: Empty)") $ ("Input:not (. Must)") |
All input elements that are not empty; elements that are not must for all class attributes |
|
|
|
: Header |
$ (": Header") |
All header elements |
: Animated |
|
All animation elements |
|
|
|
: Contains (text) |
$ ("Div:contains (' www.phpernote.com ')") |
All elements that contain www.phpernote.com strings in all DIV elements |
: Empty |
$ (". Item:empty") |
All elements of a child (element) node in the element of item for all class attributes |
: Hidden |
$ ("P:hidden") |
All the hidden <p> elements |
: Has |
$ ('. Item:has (span) ') |
All elements of the item that have the class attribute contain spans (whether direct or not) |
: Visible |
$ ("table:visible") |
All visible Tables |
|
|
|
S1,s2,s3 |
$ ("Th,td,.intro") |
All elements with a matching selection |
|
|
|
[attribute] |
$ ("a[href]") |
All a-label elements with href attributes |
[attribute=value] |
$ ("[href= ' # ']") |
The value of all href attributes equals the element of "#" |
[attribute!=value] |
$ ("[href!= ' # ']") |
The value of all HREF attributes is not equal to the element of "#" |
[attribute$=value] |
$ ("[href$= '. jpg ']") |
The value of all HREF attributes contains elements that end with ". jpg" |
|
|
|
: input |
$ (": input") |
All <input> elements |
: Text |
$ (": Text") |
<input> Elements of all type= "text" |
:p Assword |
$ (":p Assword") |
<input> Elements of all type= "password" |
: Radio |
$ (": Radio") |
<input> Elements of all type= "Radio" |
: checkbox |
$ (": checkbox") |
<input> Elements for all type= "checkbox" |
: Submit |
$ (": Submit") |
All type= "Submit" <input> elements |
: RESET |
$ (": Reset") |
<input> Elements of all type= "reset" |
: button |
$ (": Button") |
<input> Elements of all type= "button" |
: Image |
$ (": Image") |
<input> Elements of all type= "image" |
: File |
$ (": File") |
<input> Elements of all type= "file" |
|
|
|
: Enabled |
$ (": Enabled") |
All active input elements |
:d isabled |
$ (":d isabled") |
All disabled input elements |
: Selected |
$ (": Selected") |
All selected input elements |
: Checked |
$ (": Checked") |
All the input elements that are selected |