:first-child
selectorThe jQuery :first-child
selector is used to select the elements that are the first child of their parent.
:first-child
selector Syntax$(':first-child')
:first
and :first-child
:first
selector matches only a single element;:first-child
selector matches more than one element: one for each parent.:first-child
selector ExamplesFollowing is a simple example which would hightlight the first p in each matched div:
Try now