Child filters (Should know)

jQuery also has specific filters to target node's children. Here, you'll discover more about them.

Getting ready

The filters belonging to this category are:

Name

Description

:first-child

Retrieves the elements that are the first child of their parent.

:first-of-type

Collects the elements that are the first of the given type (element name).

:last-child

Retrieves the elements that are the last child of their parent.

:last-of-type

Collects the elements that are the last of the given type (element name).

:nth-child()

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

:nth-last-child()

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

Get Instant JQuery Selectors now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.