How do I duplicate item when using jquery sortable?

后端 未结 6 621
孤街浪徒
孤街浪徒 2020-11-29 20:16

I am using this method http://jqueryui.com/demos/sortable/#connect-lists to connect two lists that i have. I want to be able to drag from list A to list B but when the item

6条回答
  •  天涯浪人
    2020-11-29 21:00

    For a beginning, have a look at this, and read @Erez answer, too.

    $(function () {
        $("#sortable1").sortable({
            connectWith: ".connectedSortable",
            remove: function (event, ui) {
                ui.item.clone().appendTo('#sortable2');
                $(this).sortable('cancel');
            }
        }).disableSelection();
    
        $("#sortable2").sortable({
            connectWith: ".connectedSortable"
        }).disableSelection();
    });
    

提交回复
热议问题