다음과 같은 jQuery .each loop
:jQuery, 각각의 함수 질문
$('.table-data tbody tr td').each(function(index) {
$('.table-data tbody tr td' + ':nth-child(' + index + ')').addClass('nth-' + index);
});
문제는 작동하지만 .table-data tbody tr td'
의 마지막 요소는 클래스를 가져 오지 않습니다. 왜?
이것은 index
이 0 기반이기 때문에입니까? index
+ 1 회 반복하는 방법?
$ (이) $ 같다 ('테이블. -data tbody tr td '+': nth-child ('+ index +') ') –
@JapanPro - 예, 그 out-for 루프를 작동하는 데는 두 번째가 걸렸습니다. – Iladarsda