jQuery :first Selector
Example
Select the first
element:
$("p:first")
Try it »
Definition and Usage
The :first selector selects the first element.
**Note:** This selector only selects a single element. Use the :first-child selector to select multiple elements (one for each parent).
Most common usage: used together with other selectors to select the first element in a specified group (as in the example above).
**Tip:** To select the last element in a specified group, use the :last selector.
Syntax
$(":first")
Try it - Example
The difference between :first and :first-child
Demonstrates the difference between the :first and :first-child selectors.
jQuery selector