I have following jQuery .each loop:
$('.table-data tbody tr td').each( function(index) {
$('.table-data tbody tr td' + ':nth-child(' + index + ')' ).addClass( 'nth-' + index );
});
The problem is that it will work, but the last element of the .table-data tbody tr td' will not get a class. Why?
Is this because index is 0 based? How to make it loop for index + 1 time?