Cheatography
https://cheatography.com
A reference for jQuery (currently version 1.10) including selectors, functions, element manipulation and more.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
jQuery Links and Info
jQuery Homepage
|
jQuery Documentation
|
This cheat sheet based on, and intended to provide a printable version of, the excellent jQuery cheat sheet by @misteroom
|
Cheat sheet based on jQuery 1.10. |
jQuery Selectors: Basic
Selector |
Description |
|
Matches all elements |
|
Elements of type "element" |
|
Elements with class "class" |
|
Element with id "id" |
|
Use commas to separate selectors |
jQuery Selectors: Hierarchy
Selector |
Description |
|
Match any child which is directly within parent |
|
Match any descendant contained within ancestor |
|
Match next where it follows prev |
|
Match all siblings where following prev |
jQuery Selectors: Basic Filters
Selector |
Description |
|
Has animation in progress |
|
At position "n" in set |
|
Even elements in set |
|
First element in set |
|
After position "n" in set |
|
All headers (h1, h2 etc) |
|
Has lang attribute set to "x" |
|
Last element in set |
|
Before position "n" in set |
|
In set not matching selector "x" |
|
Odd elements in set |
|
Document root |
|
Has ID equal to URL fragment |
jQuery Selectors: Content Filters
Selector |
Description |
|
Elements containing text "x" |
|
Elements with no children |
|
Elements containing elements matching selector "x" |
|
Elements with at least one child |
jQuery Selectors: Visibility Filters
Selector |
Description |
|
Hidden elements |
|
Visible elements |
jQuery Selectors: Attributes
Selector |
Description |
|
Has attribute "name" |
|
Where "name" equals "val" |
|
Where "name" equals "val" or starts "val-" |
|
Where "name" contains "val" |
|
Where "name" contains "val" as a word |
|
Where "name" starts with "val" |
|
Where "name" ends with "val" |
|
Missing attribute "name", or "name" does not equal "val" |
|
jQuery Selectors: Child Filters
Selector |
Description |
|
Elements which are the first child of their parent |
|
Elements which are, of their element type, the first child |
|
Last child of their parent |
|
Of their element type, the last child |
|
Elements which are the nth child of their parent |
|
As :nth-child, but counting from last element in set backwards |
|
As nth child, but matching by element |
|
As :nth-of-type, but counting from last element in set backwards |
|
Elements which are only child of their parent |
|
Elements which are only child, of their element type, of their parent |
1 These selectors are 1-indexed, not 0-indexed
jQuery Selectors: Forms
Selector |
Description |
|
Button elements |
|
Checkbox elements |
|
Checked elements |
|
Disabled elements |
|
Enabled elements |
|
Elements with focus |
|
File elements |
|
Image elements |
|
Input, textarea, select or button |
|
Password elements |
|
Radio elements |
|
Reset elements |
|
Selected elements |
|
Submit elements |
|
Text elements |
|
|
|
|
|