Clone object is not droppable

泪湿孤枕 提交于 2019-12-01 11:16:05

You need to copy the events to the clone; pass true to clone():

$("div.field:last").clone(true).insertAfter("div.field:last");

You may also need to copy over some data from the original:

var original = $("div.field:last");
var clone = original.clone(true);
clone.data( 'droppable', jQuery.extend(true, {}, original.data('droppable')) );
/* Untested! */

I found out a way to accomplish this, by using the .live, I'm using a plugin .livequery which functions quite similiar with .live

When you bind a "live" event it will bind to all current and future elements on the page

$("input[value='Add']").livequery("click", function(e){
e.preventDefault();
$("div.field:last").clone().insertAfter("div.field:last");
$("div.field").droppable();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!