Question

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
     }


})
Was it helpful?

Solution

You can count loop like this

.each(function (i) { }

here i will give you counter value

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top