Clone object is not droppable

后端 未结 2 1974
孤城傲影
孤城傲影 2021-01-15 01:54

I\'m trying to clone a droppable object using Jquery but the cloned object is not droppable.

$(document).ready(function(){
$(\"input[value=\'Add\']\").click(         


        
2条回答
  •  轮回少年
    2021-01-15 02:06

    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! */
    

提交回复
热议问题