jQuery:Selector :last

:last()

Overview

Gets the last element.

Demo

Description:

Gets the last matched element.

HTML code:
<ul>
    <li>list item 1</li>
    <li>list item 2</li>
    <li>list item 3</li>
    <li>list item 4</li>
    <li>list item 5</li>
</ul>
jQuery code:
$('li:last')
Result:
[ <li>list item 5</li> ]

Leave a Reply

Your email address will not be published. Required fields are marked *