jQuery selectors

Sometimes it could be quite useful to remind:

Selector Type

jQuery Syntax

Basic
All Selector *
Class Selector .class
Element Selector element
ID Selector #id
Multiple Selector selector1, selector2, selectorN
 
Hierarchy
Child Selector parent > child
Descendant Selector ancestor descendant
Next Adjacent Selector prev + next
Next Siblings Selector prev ~ siblings
Attribute
Attribute Contains Prefix Selector [name|=value]
Attribute Contains Selector [name*=value]
Attribute Contains Word Selector [name~=value]
Attribute Ends With Selector [name$=value]
Attribute Equals Selector [name=value]
Attribute Not Equal Selector(non-standard) [name!=value]
Attribute Starts With Selector [name^=value]
Has Attribute Selector [name]
Multiple Attribute Selector [name=value][name2=value2]
Basic Filter(non-standard)
Animated filter :animated
Not equal filter :not()
Evenness filter :even, :odd
Comparison filter :gt(),:lt(), :eq()
Order filter :first, :last
Header filter :header
Focus filter :focus
Target filter :target
Root Filter :root
Language filter :lang
Child Filter
First/Last child filter :first-child, :last-child
First/Last of type filter :first-of-type, :last-of-type
Nth-child filter :nth-child()
Last Nth-child filter :nth-last-child()
Nth-child of type filter :nth-of-type()
Last nth-child of type filter :nth-last-of-type()
Only child filter :only-child
Only child of type filter :only-of-type
Content Filter
Contains filter :contains()
Empty filter :empty
Has filter :has()
Parent filter :parent
Visibility (non-standard) :hidden, :visible
Form
Checked filter(standard) :checked
Selected filter :selected
Disabled filter(standard) :disabled, :enabled
Input type filter :button, :file, :image, :input, :password, :radio, :checkbox, :reset, :submit, :text

 

Based on

  • http://api.jquery.com/
  • http://www.amplesdk.com/tutorials/jquery/