jQuery Tutorial Tutorials - jQuery :first-child selector

:first-child selector

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

jQuery :first-child selector Syntax

$(':first-child')

difference between :first and :first-child

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

jQuery :first-child selector Examples

Following is a simple example which would hightlight the first p in each matched div:
Try now

Date:2019-08-18 10:26:47 From:www.Lautturi.com author:Lautturi