jQuery setiap cek jika indeks terakhir

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