Show Menu

jQuery Cheat Sheet by i3quest

List of common jQuery selectors. I had compiled this list a while ago into a word document but do not remember the source now.




[name]Has Attribute
[name|­="va­lue­"]Contains Prefix (before hyphen (-))
[name~­="va­lue­"]Contains Word
[name^­="va­lue­"]Starts With
[name$­="va­lue­"]Ends With
[name!­="va­lue­"]Not Equal
[name=­"­v"][­nam­e2=­"­v2"]Multiple Attributes


:inputinput, textarea, select and button elements


:conta­ins­(text)Elements that contain the specified text.
:eq(n)Element at index n within the matched set.
:gt(n)Elements at an index greater than n within the matched set.
:lt(n)Elements at an index less than index within the matched set.
:has(s­ele­ctor)Elements which contain at least one element that matches the specified selector.
:not(s­ele­ctor)Elements that do not match the given selector.
:nth-c­hild()Elements that are the nth-child of their parent.
:emptyElements that have no children (including text nodes).
:evenEven elements, zero-i­ndexed.
:firstThe first matched element.
:headerElements that are headers, like h1, h2, h3 and so on.
:lastThe last matched element.
:oddOdd elements, zero-i­ndexed.

Element State



parent > childDirect child elements specified by "­chi­ld" of elements specified by "­par­ent­".
ancestor descendantElements that are descen­dants of a given ancestor.
selector1, selector2, selectorNCombined results of all the specified selectors.
prev + nextNext elements matching "­nex­t" that are immedi­ately preceded by a sibling "­pre­v".
prev ~ siblingsSibling elements that follow after the "­pre­v" element, have the same parent, and match the filtering "­sib­lin­gs" selector.
:first­-childElements that are the first child of their parent.
:last-­childElements that are the last child of their parent.
:only-­childElements that are the only child of their parent.
:parentElements that are the parent of another element, including text nodes.

Share This Cheat Sheet!

Favourited by 40 Members:

fkorling caroline.artz Eulerintegral333 dmooreTrinity internaciulo Theosis Coldblackice PaulBlp alexikia Dranzz Epoc and 30 more ...


DaveChild DaveChild, 09:07 24 Dec 11

I know this will make a lot of people very happy - a jQuery cheat sheet has been requested for a long time! Good job :)

Ben23 Ben23, 09:27 14 Jun 12

Should probably be called 'jQuery Selector Cheat Sheet' as it only covers that topic. Useful though, thanks,

simoneast simoneast, 08:01 8 Aug 12

Yeah, as Ben said it is only jQuery "selectors" - which are basically CSS selectors with a few helpful additions.

lek lek, 08:19 13 Aug 12

This will be great to some other beginners, like me.

Steen Steen, 21:43 11 Oct 12

Hmm, maybe it would be good to have the methods listed with args too. This is what I look up the most.

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.