Easy Tutorial
❮ Sel Attribute Equal Value Event Load ❯

jQuery :first-child Selector

jQuery Selectors

Example

Select the first <p> element that is the first child of its parent:


Definition and Usage

The :first-child selector selects the first child element of its parent.

Tip: Use the :last-child selector to select the last child element of its parent.


Syntax


Try it - Examples

Select the first <p> element within all <div> elements

Differences between :first and :first-child

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


jQuery Selectors

❮ Sel Attribute Equal Value Event Load ❯