JavaScript - Clicking on item and deleting it from the parent div?

So, I got an parent div and child divs. JavaScript creates child divs, ID & the text inside is different.. So I am trying to do next. There will be X behind of each item and if you click it will remove the item, is that possible to do? I tried something with JavaScript, but I didn't understand how to do that part if you click on that item then it removes that. Also, it has to remove one class as well which contains same item name. I will put some code down below.

Those div's which are under the itemcart, are added by JavaScript, by clicking "item-card". Item-card get's names from the picture title (image of item). If the item-card is clicked, then it adds class "item-selected". If the item will be deleted by clicking on it, then it should also remove that item-selected class from the right item on item card. Is something like that possible to do?