Latest web development tutorials

jQuery: last-of-type selector

jQuery selector jQuery selector

Examples

Each <p> element belonging to its parent element selected last <p> element:

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

try it"

Definition and Usage

: Last-of-type selector to select all elements belonging to a particular type of parent element the last child element.

Note: The selector with: nth-last-of-type (1) the same.

Tip: Use : first-of-type selector to select all of the elements belonging to the first child element of its parent element of a particular type.


grammar

$(":last-of-type")


Examples

Try - Example

Select all <div> elements in the last <p> element
How to select all <div> elements in the last <p> element.

: last,: last-of-type different between the: last-child and
Demo: last,: different last-of-type selector between: last-child and.


jQuery selector jQuery selector