jQuery :first-child selector
Example
Select the first element among the children of
the parent element that is a
element:
$("p:first-child")
Try it »
Definition and Usage
The :first-child selector picks the first child element of its parent.
**Tip:** Please use :last-child The selector to pick the last child element of its parent.
Syntax
$(":first-child")
Try it - Example
first element in the
Element
How to select all
first element in the
.
The difference between :first and :first-child
Demonstrates the difference between the :first and :first-child selectors.
The difference between :first, :first-child and :first-of-type
Demonstrates the difference between the :first, :first-child and :first-of-type selectors.
jQuery selector