I got some boxes on the left that are draggable. When they are dragged, they are cloned, so you can put as many boxes as you want.
When they are dragged to the .sortable
I want them to be removed by clicking on the x
of a link.
<div class="draggable">
<div class="structure">
<div class="item1 e1" data-class="e1" data-parent="w1">New block <a href="javascript:;" class="remove">X</a></div>
<div class="item1 e2" data-class="e2" data-parent="w2">New headline <a href="javascript:;" class="remove">X</a></div>
</div>
</div>
<div class="sortable"></div>
This is my Script:
$(".sortable").sortable();
$(".structure .item1").draggable({
connectToSortable: ".sortable",
helper: "clone"
});
$(".remove").on("click", function () {
alert("Hello out there!");
});
Unfortunately this x
doesn't seem to do anything. Nothing happens. Do you have an idea what I'm doing wrong?
Here you find a demo https://codepen.io/alphafrau/pen/WNMJpow