:last Selector

Selects the last matched element.


As of jQuery 3.4, the :last pseudo-class is deprecated. Remove it from your selectors and filter the results later using .last().

Note that :last selects a single element by filtering the current jQuery collection and matching the last element within it.

Finds the last table row.

    <td>First Row</td>
    <td>Middle Row</td>
    <td>Last Row</td>
$("tr").last().css({ backgroundColor: "yellow", fontWeight: "bolder" });

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)