Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery :last-of-type Selector

jQuery :last-of-type Selector

jQuery selector jQuery selector

Example

Select the last

element of every

element:

$("p:last-of-type")

Try it »


Definition and Usage

The :last-of-type selector selects all elements that are the last child of their specific type within their parent.

**Tip:** This selector is the same as :nth-last-of-type(1).

**Tip:** Please use :first-of-type selector to select all elements that are the first child of their specific type within their parent.


Syntax

$(":last-of-type")


Try it - Example

Select all

The last of the element

Element
How to select all

The last of the element

.

Difference between :last, :last-child, and :last-of-type
Demonstrate the difference between the :last, :last-child, and :last-of-type selectors.


jQuery selector jQuery selector