The :nth-last-of-type() Selector is used to select all child of a parent with same element name, counting from the last to first. It uses 1-indexed counting.
- n: It select nth element from last.
- even: It select every even element from last.
- odd: It select every odd element from last.
- formula: It holds the formula to generate grouping of element, starting from last, For example: 3n+2 selects every element which is output of this expression by taking values of n-0, 1, 2, …
Example 1: This example use :nth-last-of-type() selector to select odd element from last.
Example 2: This example use :nth-last-of-type() selector to select last element.
- jQuery | :lt() Selector
- jQuery | * Selector
- jQuery | :contains() Selector
- jQuery | :gt() Selector
- jQuery | :even Selector
- jQuery | :last Selector
- jQuery | :odd Selector
- jQuery | #id Selector
- jQuery | :not() Selector
- jQuery | :has() Selector with example
- jQuery | :first Selector
- jQuery | :header Selector
- jQuery | :parent Selector
- jQuery | [attribute^=value] Selector
- How to get a DOM Element from a jQuery Selector ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.