JQuery droppable, delete item

A small question, hopefully with a simple answer, I use jQuery draggable and droppable to put items in the dock. Using the code below to delete.

$("#dock").droppable({ drop: function(event, ui) { //Do something to the element dropped?!? } }); 

However, I could not find a way to get which element was actually reset, so I can do something. Is it possible?

+47
jquery jquery-ui jquery-ui-droppable jquery-ui-draggable
Jun 04 2018-10-10T00:
source share
1 answer

From the migration event documentation :

This event is fired when a received draggable is discarded by the 'over' (within the tolerance) of this Droppable. In the callback, $ (this) represents the discarded drag and drop. ui.draggable represents the draggable.

So:

 $("#dock").droppable({ drop: function(event, ui) { // do something with the dock $(this).doSomething(); // do something with the draggable item $(ui.draggable).doSomething(); } }); 
+89
Jun 04 2018-10-14T00:
source share



All Articles