Add numbers

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

Here is fiddle https://jsfiddle.net/heybetov1998/b8w3qqjf/1/

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.