You need to keep track of the list of elements and then use that to determine the index:
var $all_lis = $('li');
$all_lis.on('click', function() {
var index = $all_lis.index(this);
alert(index);
});
Demo
The first item will give 0, the last item will give 8 (i.e. 9th item).