I am trying to perform a deletion on a page that is populated with data using an ajax call. my page has this before loading the data:
<span id="ShowSelectedCategories"></span>
and after ajax call I fill in the following information:
function(data){ $('#ShowSelectedCategories').prepend('<a href="" id="'+b.SelectedCategoriesID+'" class="DeleteCat"> x <span style="color:red">' + data +'</span> </a>  '); }
and finally, after clicking the "I want to delete an item with a click" button, but it does not work.
$(function(){ $("#ShowSelectedCategories").click(function(e){ e.target.outerHTML
I tried $(".DeleteCat).click() , but it gave an error because elements with this class were created dynamically.
Your help is appreciated.
source share