Make a with JS new added DIV also droppable?
Hi everybody,
I got a, perhaps very easy or perhaps not solvable question about the droppable function, I could not find anything about this so far.
I got a basket, and a couple of products.
The products are draggable and the basket is droppable. This of course is done in the
-
$(document).ready(function(){}
and works fine.
Now I got a button “add new basket” and if the user clicks on it, Javascript generates a new basket like this
-
function addElement() {
var content = document.getElementById('content');
var newbasket = document.createElement('div');
newbasket.setAttribute('id',’basket2’);
content.appendChild(newbasket);
}
And now of course the “basket2” div should also be droppable so that my products can be dropped there. But this does now work because the droppable + draggable settings were made in the “ready function” before the new “basket2” div was existing.
Is there any way to perhaps reload the droppable + draggable settings that they also fit to the new basket or some other ways?
Im looking forward to your answers, thank you very much!
YAK