Reputation: 312
Is there a way to check which .draggable element has been dropped on a .droppable ?
I have a .droppable box and many elements which are .draggable.
I need to make that if an element has been dropped, it can still be dragged, but not dropped again. .droppable triggers an event and if I drop the same object, it triggers it again and I dont want that.
Upvotes: 1
Views: 891
Reputation: 312
I found a way to see which element has been dropped last and what elements have been dropped alltogether
var lastdropped;
var alreadydropped = new Array();
$( ".droppable" ).droppable({
drop: function( event, ui ) {
lastdropped = $(event.srcElement).attr('class').split(' ')[0];
alreadydropped.push(lastdropped);
}
})
Upvotes: 2