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?
精彩评论