javascript - In jQuery, what's the proper way to "move" an element from its parent to another element? -
using jquery 1.4 , jqueryui 1.8
specifically, i'm using draggables/droppables, , when dropped, move draggable (it's children, events, etc) belonging parent element appended/added child of drop target.
i know in droppable drop
option, can supply following callback:
function(event, ui) { // stuff }
where $(this).target
drop target, , ui.draggable
child element move - i'm not sure proper way perform move, preserving events, etc.
append()
remove element , place want.
$(this).target.append(ui.draggable); // or, if $(this).target not jquery object var target = $(this).target; $(target).append(ui.draggable);
Comments
Post a Comment