I am trying to remove a div element with javascript.I have following code but for some reason it is not working
HTML:
<div id="yes-drop" class="draggable drag-drop"><img src="{% static 'images/car.png' %}" class="brand"><button onclick="removediv()">-</button> </div>
<div id="yes-drop" class="draggable drag-drop"><img src="{% static 'images/abc.png' %}" class="brand"><button onclick="removediv()">-</button> </div>
<div id="yes-drop" class="draggable drag-drop"><img src="{% static 'images/bat.png' %}" class="brand"><button onclick="removediv()">-</button> </div>
<div id="yes-drop" class="draggable drag-drop"><img src="{% static 'images/dog.png' %}" class="brand"><button onclick="removediv()">-</button> </div>
my JS
function removediv(input) {
document.getElementById('yes-drop').removeChild(input.parentNode);
}
In the fiddle I want to remove the element once when it is dragged.(After dragging a clone of element is formed
Update 1
My main aim is that I should be able to remove any of those element when I click the button for that particular element
Update 2
In my fiddle when I drag a element a copy of that element is created.I want to remove/delete that copy of element when button is clicked