jquery ui drag and drop - call function on drop -
i want alert('dropped'); execute when drop item div. drop event handler doesn't seem function.
$('.dropme').sortable({ connectwith: '.dropme', cursor: 'pointer' }).droppable({ accept: '.button', activeclass: 'highlight', drop: function(event, ui) { var $li = $('<div>').html('list ' + ui.draggable.html()); $li.appendto(this); alert('dropped'); } }); here link fiddle: http://jsfiddle.net/8snsf/2195/
advice appreciated always.
the issue because it's sortable() plugin has enabled drag/drop behaviour. therefore need use stop handler of plugin, not drop of draggable(). try this:
$('.dropme').sortable({ connectwith: '.dropme', cursor: 'pointer', stop: function(event, ui) { var $li = $('<div>').html('list ' + ui.item.html()); $li.appendto(this); alert('dropped'); } });
Comments
Post a Comment