jQuery first()Method
Example
Select the first <p> element inside the first <div> element:
$("div p").first()
Try it Yourself »
Definition and Usage
The first() method returns the first element of the selected elements.
Tip:To return the last element, use thelast()method.
Syntax
$(selector).first()
More Examples
Select the first <span> element in the collection of <p> elements
How to select the first <span> element within a set of <p> elements.
Other Extensions
jQuery
Traversal Methods