Add numbers

Hello there, how can i make start adding numbers from 1, not add element to hiddenElement classed td

Here is fiddle

The following line is causing the problem threre:

    $('#' + i + ' a').html(castingArr[i]);

Instead of getting the item with the current index, we can instead shift the first item off the array each time.

    $('#' + i + ' a').html(castingArr.shift());

If you want to keep castingArr unchanged though, you’ll need a separate index variable to keep track of where you are:

var castingArr = [...];
castingIndex = 0;
    $('#' + i + ' a').html(castingArr[castingIndex]);
    castingIndex += 1;

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.