Answers for "jquery each check if last index"

0

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
    }
});
Posted by: Guest on December-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language