• jQuery
  • jQuery UI
  • jQuery Mobile
  • Sizzle
  • QUnit
  • Plugins
  • Contribute
    • CLA
    • Style Guides
    • Bug Triage
    • Code
    • Documentation
    • Web Sites
  • Events
  • Support
    • Learning Center
    • Chat
    • Stack Overflow
    • Report a bug
  • OpenJS Foundation
    • Join
    • Members
    • jQuery Team
    • Governance
    • Conduct
    • Projects

jQuery API Documentation

  • Download
  • API Documentation
  • Blog
  • Plugins
  • Browser Support
  • Version Support

Category: 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.

Also in: Selectors > Basic

All Selector (“*”)

Selects all elements.

Also in: 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.

Also in: 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 (-).

Also in: Selectors > Attribute

Attribute Contains Selector [name*=”value”]

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

Also in: 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.

Also in: 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.

Also in: Selectors > Attribute

Attribute Equals Selector [name=”value”]

Selects elements that have the specified attribute with a value exactly equal to a certain value.

Also in: 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.

Also in: Selectors > Attribute

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

Selects elements that have the specified attribute with a value beginning exactly with a given string.

Also in: Selectors > Form | Selectors > jQuery Extensions

:button Selector

Selects all button elements and elements of type button.

Also in: Selectors > Form | Selectors > jQuery Extensions

:checkbox Selector

Selects all elements of type checkbox.

Also in: Selectors > Form

:checked Selector

Matches all elements that are checked or selected.

Also in: Selectors > Hierarchy

Child Selector (“parent > child”)

Selects all direct child elements specified by “child” of elements specified by “parent”.

Also in: Selectors > Basic

Class Selector (“.class”)

Selects all elements with the given class.

Also in: Selectors > Content Filter | Selectors > jQuery Extensions

:contains() Selector

Select all elements that contain the specified text.

Also in: Selectors > Hierarchy

Descendant Selector (“ancestor descendant”)

Selects all elements that are descendants of a given ancestor.

Also in: Selectors > Form

:disabled Selector

Selects all elements that are disabled.

Also in: Selectors > Basic

Element Selector (“element”)

Selects all elements with the given tag name.

Also in: Selectors > Content Filter

:empty Selector

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

Also in: Selectors > Form

:enabled Selector

Selects all elements that are enabled.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:eq() Selector

Select the element at index n within the matched set.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:even Selector

Selects even elements, zero-indexed. See also :odd.

Also in: Selectors > Form | Selectors > jQuery Extensions

:file Selector

Selects all elements of type file.

Also in: Selectors > Child Filter

:first-child Selector

Selects all elements that are the first child of their parent.

Also in: Selectors > Child Filter

:first-of-type Selector

Selects all elements that are the first among siblings of the same element name.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:first Selector

Selects the first matched DOM element.

Also in: Selectors > Basic Filter | Selectors > Form

:focus Selector

Selects element if it is currently focused.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:gt() Selector

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

Also in: Selectors > Attribute

Has Attribute Selector [name]

Selects elements that have the specified attribute, with any value.

Also in: Selectors > Content Filter | Selectors > jQuery Extensions

:has() Selector

Selects elements which contain at least one element that matches the specified selector.

Also in: Selectors > Basic Filter | Selectors > jQuery Extensions

:header Selector

Selects all elements that are headers, like h1, h2, h3 and so on.

Also in: Selectors > jQuery Extensions | Selectors > Visibility Filter

:hidden Selector

Selects all elements that are hidden.

Also in: Selectors > Basic

ID Selector (“#id”)

Selects a single element with the given id attribute.

Also in: Selectors > Form | Selectors > jQuery Extensions

:image Selector

Selects all elements of type image.

Also in: Selectors > Form | Selectors > jQuery Extensions

:input Selector

Selects all input, textarea, select and button elements.

Also in: Selectors > Basic Filter

:lang() Selector

Selects all elements of the specified language.

Also in: Selectors > Child Filter

:last-child Selector

Selects all elements that are the last child of their parent.

Also in: Selectors > Child Filter

:last-of-type Selector

Selects all elements that are the last among siblings of the same element name.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:last Selector

Selects the last matched element.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:lt() Selector

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

Also in: Selectors > Attribute

Multiple Attribute Selector [name=”value”][name2=”value2″]

Matches elements that match all of the specified attribute filters.

Also in: Selectors > Basic

Multiple Selector (“selector1, selector2, selectorN”)

Selects the combined results of all the specified selectors.

Also in: Selectors > Hierarchy

Next Adjacent Selector (“prev + next”)

Selects all next elements matching “next” that are immediately preceded by a sibling “prev”.

Also in: 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.

Also in: Selectors > Basic Filter

:not() Selector

Selects all elements that do not match the given selector.

Also in: Selectors > Child Filter

:nth-child() Selector

Selects all elements that are the nth-child of their parent.

Also in: 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.

Also in: 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.

Also in: 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.

Also in: Selectors > Basic Filter | Deprecated > Deprecated 3.4 | Selectors > jQuery Extensions

:odd Selector

Selects odd elements, zero-indexed. See also :even.

Also in: Selectors > Child Filter

:only-child Selector

Selects all elements that are the only child of their parent.

Also in: Selectors > Child Filter

:only-of-type Selector

Selects all elements that have no siblings with the same element name.

Also in: Selectors > Content Filter | Selectors > jQuery Extensions

:parent Selector

Select all elements that have at least one child node (either an element or text).

Also in: Selectors > Form | Selectors > jQuery Extensions

:password Selector

Selects all elements of type password.

Also in: Selectors > Form | Selectors > jQuery Extensions

:radio Selector

Selects all elements of type radio.

Also in: Selectors > Form | Selectors > jQuery Extensions

:reset Selector

Selects all elements of type reset.

Also in: Selectors > Basic Filter

:root Selector

Selects the element that is the root of the document.

Also in: Selectors > Form | Selectors > jQuery Extensions

:selected Selector

Selects all elements that are selected.

Also in: Selectors > Form | Selectors > jQuery Extensions

:submit Selector

Selects all elements of type submit.

Also in: Selectors > Basic Filter

:target Selector

Selects the target element indicated by the fragment identifier of the document’s URI.

Also in: Selectors > Form | Selectors > jQuery Extensions

:text Selector

Selects all input elements of type text.

Also in: 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.7
    • Deprecated 1.8
    • Deprecated 1.9
    • Deprecated 1.10 & 2.0
    • Deprecated 3.0
    • Deprecated 3.2
    • Deprecated 3.3
    • Deprecated 3.4
    • Deprecated 3.5
    • Deprecated 3.7
  • 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, 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
  • 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.11 & 2.1
    • Version 1.12 & 2.2
    • Version 3.0
    • Version 3.1
    • Version 3.2
    • Version 3.3
    • Version 3.4
    • Version 3.5
    • Version 3.6
    • Version 3.7
    • Version 4.0

Books

  • Learning jQuery 4th Edition by Karl Swedberg and Jonathan Chaffer Learning jQuery Fourth Edition Karl Swedberg and Jonathan Chaffer
  • jQuery in Action by Bear Bibeault, Yehuda Katz, and Aurelio De Rosa jQuery in Action Bear Bibeault, Yehuda Katz, and Aurelio De Rosa
  • jQuery Succinctly by Cody Lindley jQuery Succinctly Cody Lindley
  • Learning Center
  • Chat
  • Twitter
  • GitHub

Copyright 2025 OpenJS Foundation and jQuery contributors. All rights reserved. See jQuery License for more information. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. OpenJS Foundation Terms of Use, Privacy, and Cookie Policies also apply.

Web hosting by Digital Ocean | CDN by Fastly | Powered by WordPress