Delete Cart JavaScript

I have started making a shopping cart, but there’s a problem with my code that when I try to delete a row by button “X” it doesn’t work.
Code is below with HTML,CSS & JavaScript

Well, querySelector will only grab a single element. You should look into querySelectorAll which will be a NodeList. It returns an array-like object.


it worked thank you.
I thought “querySelectorAll” I should use when I have multiple images, but is the reason that I have multiple classes on my parent div and that’s why i need to use querySelectorAll ?

querySelectorAll should be used when you need to apply some logic to all elements which are specified by the selector used. If you have multiple items in a cart and they all have the same class or some other identifier which are related, then you would use querySelelctorAll should be used. If you only have a single element to select or only want the first such element, then querySelector should be used.