I am trying to build a form builder that can drag div and place one after another and can also place input controls inside it.
It can sort the controls. (refer below : picture) First I drag two Div container and place it inside the master container. After that when I try to place Div2
inside Div1
I am not able to get the event target id.
This happens only when two div's are inside the master container. When I drag and drop one div over another from field types I get the correct target id.
See Fiddle :
To recreate first drag Div to mastercontainer(id)
first then try to drag it childcontainer(id)
$('.containerHolder').sortable({
connectWith: '.containerHolder',
scroll: false,
revert: true,
zIndex: 10000,
helper: "clone",
placeholder: "control-placeholder",
stop: function (event, ui) {
alert(event.target.id);
}
});
$("#fieldTypes li").draggable({
connectToSortable: ".containerHolder",
helper: "clone",
revert: "invalid",
});
$(".containerHolder").disableSelection();
question from:
https://stackoverflow.com/questions/65913940/jquery-sortable-draggable-not-able-to-get-correct-event-target-id 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…