I have a ui draggable that connects to a sortable list with helper clone.
开发者_开发百科$(".mydrag").draggable({
helper:'clone',
handle: '.drag',
connectToSortable:'.new',
start: function(event, ui) { console.log(ui);
var id = ui.helper[0].id;
$(ui.helper).attr("id","new-"+id);
}
});
When start the drag I and a prefix of "new-" at the id expecting that when received by the sortable will sit as new-id. But its not working.
I also tried to change the context
$(ui.helper.context).attr("id","new-"+id);
but in this case change the id of the received element in the sortable BUT it also change the id of the original item
I also tried to change the id when sortable receives the new element but change the id of the original item (because when receiving there are 2 elements with the same id)
So I am really stuck. Any help appreciated
精彩评论