I have an array. I am getting data from Array and using it in jQuery Append to list. But when I am clicking on list item its only showing the last element.
you must use this in the click function to refer to the current item clicked from list:
$(".divClass").on('click', function(e){
var index = $(this).index();
var text = $(this).text();
alert('text: ',text, 'index: ',index);
e.preventDefault();
});