Easy Tutorial
❮ Event Change Eff Fadein ❯

jQuery :first-of-type Selector

jQuery Selectors

Example

Selects every <p> element that is the first <p> element of its parent:


Definition and Usage

The :first-of-type selector selects all elements that are the first child of their parent in the list of children of a particular type.

Tip: This selector is equivalent to :nth-of-type(1).

Tip: Use the :last-of-type selector to select all elements that are the last child of their parent in the list of children of a particular type.


Syntax


Try It - Examples

Select the first <p> element of every <div> element

Differences between :first, :first-child, and :first-of-type


jQuery Selectors

❮ Event Change Eff Fadein ❯