To get the index, use .index() as follows:
$("#content > div").click(function() { alert($(this).index()); });
If they are not next to each other, use this:
$(".selector").click(function() { alert($(this).index(".selector")); });
.index() returns an index based on 0, just as you went to .eq() . Your question really raises an interesting point, but why .eq() without arguments returns an index ...
source share