:nth-last-child
selectorThe jQuery :nth-last-child
selector is used to select all the elements that are the nth-child of their parent,counting from the last.
:nth-last-child
selector Syntax$(':nth-last-child(index/even/odd/equation')
:nth-child(2)
and :nth-last-child(2)
:nth-child(2)
is selecting second child,counting from the first
element to the last
;:nth-last-child(2)
is selecting second child,counting from the last
element to the first
;:nth-last-child
selector ExamplesIn below example,We will hightlight third p in each matched div, counting from last child to the first