I am appending values from an array of objects to a div tag. The append just works fine, but the click event on the appended HTML elements are not working
let lists = [{name : "one", desc : "test"}, {name : "two", desc : "desc"}]
for(let a in lists)
$('#list').append('<div class="listing"><li id="' + lists[a].name +'" data-list-name="'+ lists[a].name +'"><h3>'+lists[a].name +'</h3></li><span class="view-more"></span><div class="view-more-container"><p class="list-text"><b>'+lists[a].desc +'</b></p></div></div>');
Here the value is appended as expected but click function on the class view-more is not working after appending. it works for direct values and doesn't work for appended one