$.each() index start number in jQuery

前端 未结 8 1949
慢半拍i
慢半拍i 2021-01-05 02:28

How do I start jQuery $.each() index from 1 instead of 0?

I am using .each function to populate select box. So here I want to populate options in the se

8条回答
  •  既然无缘
    2021-01-05 02:46

    This is what I did:

    var start = index + 1;
    

    This just adds 1 to the current index.. then use that new variable instead of 'index'.

提交回复
热议问题