jQuery Tutorial Tutorials - jQuery :last-child selector

:last-child selector

The jQuery :last-child selector is used to select the elements that are the last child of their parent.

jQuery :last-child selector Syntax

$(':last-child')

difference between :last and :last-child

  • jQuery :last selector matches only a single element;
  • jQuery :last-child selector matches more than one element: one for each parent.

jQuery :last-child selector Examples

Following is a simple example which would hightlight the last p in each matched div:

Try now

Date:2019-08-18 11:29:33 From:www.Lautturi.com author:Lautturi