Ajax remove() on drop

I have a dynamically generated list held in div id DesktopIcons, each list item has its own id DesktopIcons-# where # is a number 0-x based on the number of items in the users list.
I want to ONLY delete the list item dropped on Div id trashcan, where as the issue i cant get past is deleting the entire DesktopIcons div.

heres the code i have come up with so far.

$(function() { $( "#DesktopIcons" ).draggable(); $( "#trashcan" ).droppable( { drop: function( event, ui ) { $(" #DesktopIcons" ).remove(); } }); });

w00t Got it!

$(function() { $( "#DesktopIcons" ).draggable(); $( "#trashcan" ).droppable({ accept: '#DesktopIcons > div', drop: function( event, ui ) { ui.draggable.remove(); } }); });

works perfect.

Sponsor our Newsletter | Privacy Policy | Terms of Service