jQuery :first-of-type Selector
Example
Select the first
element of every
element:
$("p:first-of-type")
Try it »
Definition and Usage
The :first-of-type selector selects all elements that are the first child of their specific type within their parent.
**Tip:** This selector is the same as :nth-of-type(1).
**Tip:** Please use :last-of-type selector to select all elements that are the last child of their specific type within their parent.
Syntax
$(":first-of-type")
Try it - Example
first element in the
Element
How to select all
first element in the
.
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