jQuery droppables - Change element on drop

后端 未结 2 1930
再見小時候
再見小時候 2021-02-10 19:04

I\'m a bit new to jQuery and hope somebody can help me out.

I\'m trying to change an element (li) to another element (div) after the (li) has been dropped.

Sampl

2条回答
  •  独厮守ぢ
    2021-02-10 19:42

    thanx for the reply.

    Your first code worked, and plus I can also sort the divs in the droppable like this:

        drop: function(ev, ui) {
        $(this).append("
    Some content
    "); $("#dropEl").sortable(); }

    Now the problem is how do I know which list is which once I have changed it to divs?

    I use the following code to get each element id:

    drop: function(ev, ui) {
                revert: true;
                var this_id = $(ui.draggable).attr("id");
                $(this).append('
    Some content
    '); $("#dropEl").sortable(); }

提交回复
热议问题