jQuery last()Method

jQuery 遍历方法jQuery Traversal Methods

Example

Select the last <p> element inside the last <div> element:

$("p").last()

Try it Yourself »

Definition and Usage

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

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


Syntax

$(selector).last()


实例

More Examples

Select the last <span> element in the set of <p> elements
How to select the last <span> element among a group of <p> elements.


jQuery 遍历方法jQuery Traversal Methods

Other Extensions