I added listener to element, which has been created dynamically - according to this - Jquery event handler not working on dynamic content [duplicate] .
But how can I get id of the element?
$(document.body).on('click', '.list-group-item', function(){
var itemId=this.attr("id");
This approach is wrong - the outcome is:
TypeError: this.attr is not a function
So in this case - how can I get id of my '.list-group-item' which has been clicked?