Latest web development tutorials

jQuery last () method

jQuery traversal methods jQuery traversal methods

Examples

Finally, select a <div> last <p> element within the element:

$("p").last()

try it"

Definition and Usage

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

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


grammar

$(selector).last()


Examples

More examples

Select <p> The last element in the set <span> element
How to select the <p> element in the set of the last <span> element.


jQuery traversal methods jQuery traversal methods