How can I fix or cancel the touchmove event when the element is removed? [Solved]
I have the code below. I added the events mousemove and touchmove to one(at a time) of the moving divs. The goal is to find the right element and drag it to the circle at the bottom-left corner. Now, the mousemove works just as I expected. The element goes near the circle and then it gets removed. Another element is selected, the same events are added, and so on. But, using the touchmove, if I do not get my finger up from the screen after the element is removed, the next selected element is suddenly dragged to the circle where it also gets removed, and the cycle continues until there are 0 elements left. I searched on google but couldn't find a way to solve it and I have no idea what to do. How do I force end of the touchmove? Or what are the alternative to avoid that bug? [Code removed since the problem is solved]