Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery last() method

jQuery last() method

jQuery Traversal Methods jQuery Traversal Methods

Example

Select the last

the last inside the element

element:

$("p").last()

Try it »


Definition and Usage

The last() method returns the last element of the selected elements.

**Tip:** To return the first element, use first() method.


Syntax

$(

selector

).last()


More examples

Select

the last in the collection of elements Element
How to select

the last in the collection of elements .


jQuery Traversal Methods jQuery Traversal Methods