jQuery :firstoftype Selector (original) (raw)

jQuery :first-of-type Selector

Last Updated : 11 Jul, 2025

The jQuery :first-of-type Selector is used to select all elements that are the first child, of a particular type, of their parent.

Syntax:

$(":first-of-type")

The below examples illustrate the:first-of-type selector in jQuery:

Example 1: This example changes the background color to green and the text color to white, of the first heading of their parents (div tags).

HTML `

jQuery | :first-of-type Selector