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'));      } }); 

http://jsfiddle.net/rahulrulez/gg4z10v4/


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -