jQuery chacun vérifie si le dernier index

var total = $('ul li').length;
$('ul li').each(function(index) {
    if (index === total - 1) {
        // this is the last one
    }
});
Elegant Elephant