W3cubDocs

/jQuery

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.

:animated Selector

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

:empty Selector

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

:eq() Selector

Select the element at index n within the matched set.

:gt() Selector

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

:has() Selector

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

:header Selector

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

:lt() Selector

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

:not() Selector

Selects all elements that do not match the given selector.

:nth-last-child() Selector

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

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

:nth-of-type() Selector

Selects all elements that are the nth child of their parent in relation to siblings with the same element name.

:odd Selector

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

:parent Selector

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

:root Selector

Selects the element that is the root of the document.

:target Selector

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

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jquery.com/category/selectors