没有工作可拖动/可拖放附加

尝试动态拖动元素时遇到问题。 当我相信它时,我的问题就开始了,它可以在它们之间移动但不会移向另一个容器

function info_drag(){ var $container = $(".task-container"); var $task = $('.todo-task'); $task.draggable({ addClasses: false, connectToSortable: ".task-container", }); $container.droppable({ accept: ".todo-task", }); $(".ui-droppable").sortable({ placeholder: "ui-state-highlight", opacity: .5, helper: 'original', beforeStop: function (event, ui) { newItem = ui.item; }, receive: function (event, ui) { //get task-type and task id. var tasktype = $(this).find('.task-type').html(); var taskid = $(this).find('.task-no').html(); console.log(taskid); console.log(tasktype); dropElement = $(this).attr('id'); console.log(dropElement); // console.log($(this).closest('.ui-droppable').attr('id')); //save the status and the order of the item. if (dropElement == "backlog") { // save the status of the item } else if (dropElement == "pending") { // save the status of the } else if (dropElement == "inProgress") { } else if (dropElement == "completed") { } } }).disableSelection().droppable({ over: ".ui-droppable", activeClass: 'highlight', drop: function (event, ui) { $(this).addClass("ui-state-highlight"); } }); 

}

info_drag(); //调用函数

在ajax中,创造元素dinamic

  html = '
'; html += '
'; html += '
# '+parsedJSON[i].idorder+'
'; html += '
/ Mesa '+parsedJSON[i].idmesa+'
'; html += '
'; html += '
'; html += '
'+parsedJSON[i].nombre+' '+parsedJSON[i].paterno+'
'; html += '
'; html += ''; $('#backlog').append(html);

可拖动的工作,但我的droppable元素不接受。 todo-task如此充满活力。 当创建元素时,除了动态之外,它们的工作方

在此处输入图像描述