jquery draggable stop event -
i have searched lot of.but can't find answer.maybe dublicate.here bit of 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 , draggable options.but isn't helpfull.in other word how access dropped element using draggable options,events , methods. dublicate jquery droppable, element dropped
how dropped element id if dropped draggable stop function.
it's easy 1 in droppable
. not draggable
there's hacky way id of dropped element on stop event in draggable
...
i tried in previous projects, works charm.
try :
$( "#draggable" ).draggable( { handle: "p", stop: function(event, ui){ console.log(event); console.log($(ui.helper[0]).children().attr('id')); } });
Comments
Post a Comment