문제

I've a simple each loop and I want count loops of this while,and find The final number then save counter variable and use in my codes, how can do posible...??!

var counter = 0;

$.each(data, function( key, value) {
  counter++;
     if(counter == /*The final number*/)
     {
        //Do Some Codes
     }


})
도움이 되었습니까?

해결책

You can count loop like this

.each(function (i) { }

here i will give you counter value

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top