jQuery logojQuery API Documentation

  • Home
  • API Documentation
  • CDN
  • Plugins
  • Browser Support

Categories: Selectors


Borrowing from CSS 1–3, and then adding its own, jQuery offers a powerful set of tools for matching a set of elements in a document.

To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.

Selectors > Basic

All Selector ("*")

Selects all elements.
Selectors > Basic Filter | Selectors > jQuery Extensions

:animated Selector

Select all elements that are in the progress of an animation at the time the selector is run.
Selectors > Basic Filter | Selectors > jQuery Extensions

:animated Selector

Select all elements that are in the progress of an animation at the time the selector is run.
Selectors > Attribute

Attribute Contains Prefix Selector [name|="value"]

Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).
Selectors > Attribute

Attribute Contains Selector [name*="value"]

Selects elements that have the specified attribute with a value containing a given substring.
Selectors > Attribute

Attribute Contains Word Selector [name~="value"]

Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.
Selectors > Attribute

Attribute Ends With Selector [name$="value"]

Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.
Selectors > Attribute

Attribute Equals Selector [name="value"]

Selects elements that have the specified attribute with a value exactly equal to a certain value.
Selectors > Attribute | Selectors > jQuery Extensions

Attribute Not Equal Selector [name!="value"]

Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value.
Selectors > Attribute | Selectors > jQuery Extensions

Attribute Not Equal Selector [name!="value"]

Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value.
Selectors > Attribute

Attribute Starts With Selector [name^="value"]

Selects elements that have the specified attribute with a value beginning exactly with a given string.
Selectors > Form | Selectors > jQuery Extensions

:button Selector

Selects all button elements and elements of type button.
Selectors > Form | Selectors > jQuery Extensions

:button Selector

Selects all button elements and elements of type button.
Selectors > Form | Selectors > jQuery Extensions

:checkbox Selector

Selects all elements of type checkbox.
Selectors > Form | Selectors > jQuery Extensions

:checkbox Selector

Selects all elements of type checkbox.
Selectors > Form

:checked Selector

Matches all elements that are checked or selected.
Selectors > Hierarchy

Child Selector ("parent > child")

Selects all direct child elements specified by "child" of elements specified by "parent".
Selectors > Basic

Class Selector (".class")

Selects all elements with the given class.
Selectors > Content Filter

:contains() Selector

Select all elements that contain the specified text.
Selectors > Hierarchy

Descendant Selector ("ancestor descendant")

Selects all elements that are descendants of a given ancestor.
Selectors > Form

:disabled Selector

Selects all elements that are disabled.
Selectors > Basic

Element Selector ("element")

Selects all elements with the given tag name.
Selectors > Content Filter

:empty Selector

Select all elements that have no children (including text nodes).
Selectors > Form

:enabled Selector

Selects all elements that are enabled.
Selectors > Basic Filter | Selectors > jQuery Extensions

:eq() Selector

Select the element at index n within the matched set.
Selectors > Basic Filter | Selectors > jQuery Extensions

:eq() Selector

Select the element at index n within the matched set.
Selectors > Basic Filter | Selectors > jQuery Extensions

:even Selector

Selects even elements, zero-indexed. See also odd.
Selectors > Basic Filter | Selectors > jQuery Extensions

:even Selector

Selects even elements, zero-indexed. See also odd.
Selectors > Form | Selectors > jQuery Extensions

:file Selector

Selects all elements of type file.
Selectors > Form | Selectors > jQuery Extensions

:file Selector

Selects all elements of type file.
Selectors > Child Filter

:first-child Selector

Selects all elements that are the first child of their parent.
Selectors > Child Filter

:first-of-type Selector

Selects all elements that are the first among siblings of the same element name.
Selectors > Basic Filter | Selectors > jQuery Extensions

:first Selector

Selects the first matched DOM element.
Selectors > Basic Filter | Selectors > jQuery Extensions

:first Selector

Selects the first matched DOM element.
Selectors > Basic Filter | Selectors > Form

:focus Selector

Selects element if it is currently focused.
Selectors > Basic Filter | Selectors > Form

:focus Selector

Selects element if it is currently focused.
Selectors > Basic Filter | Selectors > jQuery Extensions

:gt() Selector

Select all elements at an index greater than index within the matched set.
Selectors > Basic Filter | Selectors > jQuery Extensions

:gt() Selector

Select all elements at an index greater than index within the matched set.
Selectors > Attribute

Has Attribute Selector [name]

Selects elements that have the specified attribute, with any value.
Selectors > Content Filter | Selectors > jQuery Extensions

:has() Selector

Selects elements which contain at least one element that matches the specified selector.
Selectors > Content Filter | Selectors > jQuery Extensions

:has() Selector

Selects elements which contain at least one element that matches the specified selector.
Selectors > Basic Filter | Selectors > jQuery Extensions

:header Selector

Selects all elements that are headers, like h1, h2, h3 and so on.
Selectors > Basic Filter | Selectors > jQuery Extensions

:header Selector

Selects all elements that are headers, like h1, h2, h3 and so on.
Selectors > jQuery Extensions | Selectors > Visibility Filter

:hidden Selector

Selects all elements that are hidden.
Selectors > jQuery Extensions | Selectors > Visibility Filter

:hidden Selector

Selects all elements that are hidden.
Selectors > Basic

ID Selector ("#id")

Selects a single element with the given id attribute.
Selectors > Form | Selectors > jQuery Extensions

:image Selector

Selects all elements of type image.
Selectors > Form | Selectors > jQuery Extensions

:image Selector

Selects all elements of type image.
Selectors > Form | Selectors > jQuery Extensions

:input Selector

Selects all input, textarea, select and button elements.
Selectors > Form | Selectors > jQuery Extensions

:input Selector

Selects all input, textarea, select and button elements.
Selectors > Basic Filter

:lang() Selector

Selects all elements of the specified language.
Selectors > Child Filter

:last-child Selector

Selects all elements that are the last child of their parent.
Selectors > Child Filter

:last-of-type Selector

Selects all elements that are the last among siblings of the same element name.
Selectors > Basic Filter | Selectors > jQuery Extensions

:last Selector

Selects the last matched element.
Selectors > Basic Filter | Selectors > jQuery Extensions

:last Selector

Selects the last matched element.
Selectors > Basic Filter | Selectors > jQuery Extensions

:lt() Selector

Select all elements at an index less than index within the matched set.
Selectors > Basic Filter | Selectors > jQuery Extensions

:lt() Selector

Select all elements at an index less than index within the matched set.
Selectors > Attribute

Multiple Attribute Selector [name="value"][name2="value2"]

Matches elements that match all of the specified attribute filters.
Selectors > Basic

Multiple Selector ("selector1, selector2, selectorN")

Selects the combined results of all the specified selectors.
Selectors > Hierarchy

Next Adjacent Selector ("prev + next")

Selects all next elements matching "next" that are immediately preceded by a sibling "prev".
Selectors > Hierarchy

Next Siblings Selector ("prev ~ siblings")

Selects all sibling elements that follow after the "prev" element, have the same parent, and match the filtering "siblings" selector.
Selectors > Basic Filter

:not() Selector

Selects all elements that do not match the given selector.
Selectors > Child Filter

:nth-child() Selector

Selects all elements that are the nth-child of their parent.
Selectors > Child Filter

:nth-last-child() Selector

Selects all elements that are the nth-child of their parent, counting from the last element to the first.
Selectors > Child Filter

:nth-last-of-type() Selector

Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first.
Selectors > Child Filter

:nth-of-type() Selector

Selects all elements that are the nth child of their parent in relation to siblings with the same element name.
Selectors > Basic Filter | Selectors > jQuery Extensions

:odd Selector

Selects odd elements, zero-indexed. See also even.
Selectors > Basic Filter | Selectors > jQuery Extensions

:odd Selector

Selects odd elements, zero-indexed. See also even.
Selectors > Child Filter

:only-child Selector

Selects all elements that are the only child of their parent.
Selectors > Child Filter

:only-of-type Selector

Selects all elements that have no siblings with the same element name.
Selectors > Content Filter | Selectors > jQuery Extensions

:parent Selector

Select all elements that have at least one child node (either an element or text).
Selectors > Content Filter | Selectors > jQuery Extensions

:parent Selector

Select all elements that have at least one child node (either an element or text).
Selectors > Form | Selectors > jQuery Extensions

:password Selector

Selects all elements of type password.
Selectors > Form | Selectors > jQuery Extensions

:password Selector

Selects all elements of type password.
Selectors > Form | Selectors > jQuery Extensions

:radio Selector

Selects all elements of type radio.
Selectors > Form | Selectors > jQuery Extensions

:radio Selector

Selects all elements of type radio.
Selectors > Form | Selectors > jQuery Extensions

:reset Selector

Selects all elements of type reset.
Selectors > Form | Selectors > jQuery Extensions

:reset Selector

Selects all elements of type reset.
Selectors > Basic Filter

:root Selector

Selects the element that is the root of the document.
Selectors > Form | Selectors > jQuery Extensions

:selected Selector

Selects all elements that are selected.
Selectors > Form | Selectors > jQuery Extensions

:selected Selector

Selects all elements that are selected.
Selectors > Form | Selectors > jQuery Extensions

:submit Selector

Selects all elements of type submit.
Selectors > Form | Selectors > jQuery Extensions

:submit Selector

Selects all elements of type submit.
Selectors > Basic Filter

:target Selector

Selects the target element indicated by the fragment identifier of the document's URI.
Selectors > Form | Selectors > jQuery Extensions

:text Selector

Selects all input elements of type text.
Selectors > Form | Selectors > jQuery Extensions

:text Selector

Selects all input elements of type text.
Selectors > jQuery Extensions | Selectors > Visibility Filter

:visible Selector

Selects all elements that are visible.
Selectors > jQuery Extensions | Selectors > Visibility Filter

:visible Selector

Selects all elements that are visible.
  • Ajax
    • Global Ajax Event Handlers
    • Helper Functions
    • Low-Level Interface
    • Shorthand Methods
  • Attributes
  • Callbacks Object
  • Core
  • CSS
  • Data
  • Deferred Object
  • Deprecated
    • Deprecated 1.3
    • Deprecated 1.4
    • Deprecated 1.7
    • Deprecated 1.8
    • Deprecated 1.9
    • Deprecated 1.10
    • Deprecated 3.0
    • Deprecated 3.3
  • Dimensions
  • Effects
    • Basics
    • Custom
    • Fading
    • Sliding
  • Events
    • Browser Events
    • Document Loading
    • Event Handler Attachment
    • Event Object
    • Form Events
    • Keyboard Events
    • Mouse Events
  • Forms
  • Internals
  • Manipulation
    • Class Attribute
    • Copying
    • DOM Insertion
    • DOM Insertion, Around
    • DOM Insertion, Inside
    • DOM Insertion, Outside
    • DOM Removal
    • DOM Replacement
    • General Attributes
    • Style Properties
  • Miscellaneous
    • Collection Manipulation
    • Data Storage
    • DOM Element Methods
    • Setup Methods
  • Offset
  • Properties
    • Properties of jQuery Object Instances
    • Properties of the Global jQuery Object
  • Removed
  • Selectors
    • Attribute
    • Basic
    • Basic Filter
    • Child Filter
    • Content Filter
    • Form
    • Hierarchy
    • jQuery Extensions
    • Visibility Filter
  • Traversing
    • Filtering
    • Miscellaneous Traversing
    • Tree Traversal
  • Uncategorized
  • Utilities
  • Version
    • Version 1.0
    • Version 1.0.4
    • Version 1.1
    • Version 1.1.2
    • Version 1.1.3
    • Version 1.1.4
    • Version 1.2
    • Version 1.2.3
    • Version 1.2.6
    • Version 1.3
    • Version 1.4
    • Version 1.4.1
    • Version 1.4.2
    • Version 1.4.3
    • Version 1.4.4
    • Version 1.5
    • Version 1.5.1
    • Version 1.6
    • Version 1.7
    • Version 1.8
    • Version 1.9
    • Version 1.12 & 2.2
    • Version 3.0
    • Version 3.1
    • All
  • Learning Center
  • Forum
  • API
  • Twitter
  • IRC
  • GitHub

Copyright 2018 The jQuery Foundation. jQuery License