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

updated fiddle


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -