Even though this is a duplicate question of "Event handler not working on dynamic content" , I am stuck with the same problem even after following the answers given there. Please help ....
userinfo.topics.forEach(ele=>{
$("#topics_subscribed").append(`<li class="list-group-item col-4">${ele} <i style="color:red;font-size:.7em;" class="removeitem fa fa-times"/></li>`) ;
});
$(document).on('click', '.removeitem', ()=> {
console.log('clicked') ;
$(this).parent().remove() ;
});
Please answer why its happening before marking this as duplicate . How to fix this ? (I will remove the question as soon as its answered please....)