I have searched a lot of.But I can't find answer.Maybe dublicate.Here is a bit of my code:
$(".box").draggable({
revert:"invalid",
stop:function(ev,ui){
//if(dropped) alert(ui.item.attr("id");
//else alert("Not dropped");
}
});
$(".box").droppable({
accept:function(drag){
return $(drag).attr("data-id")===$(this).attr("data-id");
},
drop:function(ev,ui){
}
});
I have looked droppable options and draggable options.But it isn't helpfull.In other word how to access dropped element using draggable options,events and methods. Also dublicate with jQuery Droppable, get the element dropped
How to get the dropped element Id if it is dropped from Draggable stop function.
It's easy to get one in
droppable
. But not withdraggable
there's hacky way to get id of dropped element on stop event indraggable
...I tried it in my previous projects, works like charm.
Try this :
http://jsfiddle.net/rahulrulez/gg4z10v4/
I use this and it works for me: