jquery each check if last code example
Example: jquery each check if last index
var total = $('ul li').length;
$('ul li').each(function(index) {
if (index === total - 1) {
// this is the last one
}
});
var total = $('ul li').length;
$('ul li').each(function(index) {
if (index === total - 1) {
// this is the last one
}
});