Easy Tutorial
❮ Traversing Last Misc Jquery Sub ❯

jQuery :first Selector

jQuery Selectors

Example

Select the first <p> element:


Definition and Usage

The :first selector selects the first element.

Note: This selector is used to select a single element only. Use the :first-child selector to select multiple elements (one from each parent).

The most common usage: Used in conjunction with other selectors to select the first element in a specific combination (as in the example above).

Tip: To select the last element in a specific combination, use the :last selector.


Syntax


Try it - Example

:first and :first-child Differences


jQuery Selectors

❮ Traversing Last Misc Jquery Sub ❯