JavaScript & jQuery Tutorials

JQ Home Right Arrow Selectors

Selectors

Click a JavaScript jQuery 1.10 Selectors signature in the table below to see in-depth information on it.

AlphabeticallyDescription
CSS 1/2 Selectorsgo to top of page Top
All Selector ("*")
(Universal Selector)
Universal selector to select all elements.
Attribute Contains Prefix Selector [attr|="value"]
(Subcode Match)
Select all elements with the specified attribute name and a value equal to the specified string or prefixed with that string followed by a hyphen (-).
Attribute Contains Word Selector [attr~="value"]
(Word Match)
Selects all elements that have the specified attribute name with a value containing the specified word, delimited by spaces.
Attribute Equals Selector [attr="value"]
(Exact Match)
Selects all elements that have the specified attribute name with a value exactly equal to the specified value.
Child Selector ("parent > child")
(Child Match)
Selects all the specified direct child elements of the specified parent element.
Class Selector (".class")
(Class Match)
Selects all elements that have the specified class.
Descendant Selector ("ancestor descendant")
(Descendant Match)
Selects all specified descendant elements of the specified ancestor element.
Element Selector ("element")
(Element Match)
Selects all elements that have the specified tag name.
:first-child Selector
(First Child Match)
Selects all first child elements of their parent.
Has Attribute Selector [attr]
(Attribute Match)
Selects all elements that have the specified attribute name.
ID Selector ("#id")
(ID Match)
Selects a single element with the specified id attribute value.
Multiple Selector
("selector1, selector2, selectorn")
(Multiple Selector Match)
Selects all elements that match any of the specified selectors.
Next Adjacent Selector ("previous + next")
(Adjacent Sibling Match)
Selects all specifed next sibling elements that are directly preceded by the specified previous sibling element.
CSS 3 Selectorsgo to top of page Top
Attribute Contains Selector [attr*="value"]
(Substring Match)
Selects all elements with the specified attribute name and a value containing the specified string.
Attribute Ends With Selector [attr$="value"]
(Suffix Match)
Selects all elements that have the specified attribute name with an ending value matching the specified string. The comparison is case sensitive.
Attribute Starts With Selector [attr^="value"]
(Prefix Match)
Selects all elements that have the specified attribute name with a starting value matching the specified string.
:checked Selector
(UI element states pseudo-class Match)
Selects all checked elements.
:disabled Selector
(UI element states pseudo-class Match)
Selects all disabled elements.
:empty Selector
(Childless Match)
Select all childless elements.
Text nodes count as children.
:enabled Selector
(UI element states pseudo-class Match)
Selects all enabled elements.
:first-of-type Selector
(Structural Pseudo-class Match)
Selects all elements that are the first among siblings of the same element name.
:lang Selector
(Structural Pseudo-class Match)
Selects all elements that match the specified language code.
:last-child Selector
(Structural Pseudo-class Match)
Selects all last child elements of their parent.
:last-of-type Selector
(Structural Pseudo-class Match)
Selects all elements that are the last among siblings of the same element name.
Next Siblings Selector ("previous ~ siblings")
(General Sibling Match)
Selects all specified sibling elements that follow after the specified previous element and have the same parent.
:not() Selector
(Negation Pseudo-class Match)
Selects all elements that do not match the given selector(s).
:nth-child() Selector
(Structural Pseudo-class Match)
Selects all elements that are the nth-child of the specified parent.
:nth-last-child() Selector
(Structural Pseudo-class Match)
Selects all elements that are the nth-child of the specified parent, counting from the last element to the first.
:nth-last-of-type Selector
(Structural Pseudo-class Match)
Selects all elements that are the last among siblings of the same element name, counting from the last element to the first.
:nth-of-type Selector
(Structural Pseudo-class Match)
Selects all elements that are the nth among siblings of the same element name.
:only-child Selector
(Structural Pseudo-class Match)
Selects all elements that are the only child of the specified parent.
:only-of-type Selector
(Structural Pseudo-class Match)
Selects all elements that have no siblings of the same element name.
:root Selector
(Structural Pseudo-class Match)
Selects the root element of the document.
:target Selector
(Structural Pseudo-class Match)
Selects the target element indicated by the fragment identifier of the document URI.
Custom Selectorsgo to top of page Top
:animated Selector
(Animating Match)
Selects all elements that are animating when the selector is run.
Attribute Not Equal Selector [attr!="value"]
(Attribute Value Non-Match)
Selects all elements that either don't have the specified attribute name, or do have the specified attribute but not with a value matching the specified string.
:contains() Selector
(Text Match)
Select all elements containing the specified text.
:first Selector
(First Element Match)
Selects first matched element.
:has() Selector
(Has Element Match)
Selects elements containing at least one element matching the specified selector.
:header Selector
(Header Element Match)
Selects all header elements.
:hidden Selector
(Hidden Element Match)
Selects all hidden elements.
:last Selector
(Last Element Match)
Selects last matched element.
Multiple Attribute Selector
[attr="value"][attrn="valuen"]
(Multiple Attribute Value Match)
Selects all elements that match all of the specified attribute and value filters
:parent Selector
(Has Children Match)
Select all elements that are the parent of another element, including text nodes.
:visible Selector
(Visible Element Match)
Selects all visible elements.
jQuery Form Selectorsgo to top of page Top
:button Selector
(Form Button pseudo-class match)
Selects all button and type button elements.
:checkbox Selector
(Form Checkbox pseudo-class match)
Selects all elements of type checkbox.
:file Selector
(Form File pseudo-class match)
Selects all elements of type file.
:focus Selector
(Form Focus pseudo-class match)
Selects currently focused element.
:image Selector
(Form Image pseudo-class match)
Selects all elements of type image.
:input Selector
(Form Input pseudo-class match)
Selects all button, input, select and textarea elements.
:password Selector
(Form Password pseudo-class match)
Selects all elements of type password.
:radio Selector
(Form Radio pseudo-class match)
Selects all elements of type radio.
:reset Selector
(Form Reset pseudo-class match)
Selects all elements of type reset.
:selected Selector
(Form Selected pseudo-class match)
Selects all selected elements.
:submit Selector
(Form Submit pseudo-class match)
Selects all elements of type submit.
:text Selector
(Form Text pseudo-class match)
Selects all elements of type text.
Index Positional Selectorsgo to top of page Top
:eq() Selector
(Index Equal Match)
Selects the element at index n within the matched set.
:even Selector
(Even Numbered Index Match)
Selects even elements within the matched set.
:gt() Selector
(Greater Than Index Match)
Select all elements with an index greater than the specified index within the matched set.
:lt() Selector
(Less Than Index Match)
Select all elements with an index less than the specified index within the matched set.
:odd Selector
(Odd Numbered Index Match)
Selects odd elements within the matched set.


 

go to jQuery home page jQuery Home go to top of page Top