Why doesn't index() working as expected

前端 未结 5 1552
余生分开走
余生分开走 2021-01-22 18:09

HTML:

Div 1
Div 2
Div 3
<
5条回答
  •  暖寄归人
    2021-01-22 18:46

    What you want to do is this:

    $(".test").each(function(i) {
        alert(i);
    });
    

    .index() returns the index relative to its siblings.

提交回复
热议问题