获取 jquery 中的元素索引

Getting index of element in jquery

我在 table 行中有以下 html 元素:

<a class="btn small small-red-button" ng-click="addTicket(d, schedule.schedule_id )" ><i class="glyphicon glyphicon-plus state"></i> <span class="text">Add Ticket</span></a>

现在根据一些值,在 angularjs 中使用 ng-repeat 重复该行(与我的问题无关)

但是现在我试图在单击该元素时使用 jquery 获取重复元素的索引:

$(document).on("click", ".btn.small", function() {
            alert($(this).index());
        });

但无论该元素重复多少次或我单击哪一个,索引总是弹出为 0。有人可以告诉我为什么吗?

只是为了根据@adeneo 评论结束这个问题

代码

$(document).on("click", ".btn.small", function() {
   alert($(".btn.small").index(this));
});