开发者

jQuery's delegate() method, index number of the current element?

Using jQuery's delegate() method, can I get the index number of the current element?

For example:

$('#tracks').delegate('.track-item', 'click', function(e) {
    e.preventDefault();
    alert(开发者_高级运维$('.track-item').index(this));
});

Does anyone have an elegant solution to this?


What you have works, you can see it in action here.

The alternative form is:

alert($(this).index('.track-item'));

You can try that one here.


That should work perfectly fine. What's the problem?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜