I want to create a nested div with jquery-ui drag and drop plugin.
I create something like this but its not work for child1 and child2.
Fiddle Link
My code is like this:
$(function () {
$('.parent,.child1,.child2').draggable({
revert: true
});
$('.dest').droppable({
accept: '.parent',
drop: function (event, ui) {
$('<div class="parent box"></div>').appendTo(this);
}
});
$('.dest .parent').droppable({
accept: '.child1',
drop: function (event, ui) {
$('<div class="child1 box"></div>').appendTo(this);
}
});
$('.dest .parent .child1').droppable({
accept: '.child2',
drop: function (event, ui) {
$('<div class="child2 box"></div>').appendTo(this);
}
});
});