I've a .dropzone div inside #trash where elements are deleted with .remove() as they are drop in it (with jquery ui .droppable and .draggable classes):
$('.dropzone').droppable({
tolerance: 'pointer',
accept: 'p',
drop: function(event, ui){
ui.draggable.remove();
$('#trashanim').animate({opacity: '1'}, 'fast')
$('#trashanim').animate({opacity: '0'}, 'slow');
}
});
(#trashanim is a brief animation of a trash bin triggered with the drop event).
Works fine until I try it with an img: after the drop event on .dropzone, the image positions itself in the left-top corner, loosing all classes in the road and getting the attributes of that position in its tag (when I test with images, I do change the accept parameter of the ui class to be able to recive 'img'). The image is not deleted from its parent.
I have implemented event-delegation as showed in this post with no results.
EDIT: When I empty() the parent node dragging another element to #trash the image does dessapear from the node. It seems like it can be deleted, but when called from another element.