johnny / jquery-sortable

A flexible, opinionated sorting plugin for jQuery
http://johnny.github.io/jquery-sortable/
Other
1.52k stars 441 forks source link

reattach event handler after a jquery .html() #276

Open olvani opened 4 years ago

olvani commented 4 years ago

Your script works fine when loading a page but when we refresh the list of elements with .html() after call ajax, I attach again the event after but everything does not work properly like the ondrop.

$ ( "# Listeelements") html (response).

//this click below linked on the element about delete works $ ('. BtnImageDelete'). On ('click', function (event) { .... });

//this sortable below linked on the element about sort works badly //the drag works but the drop zone is not displayed and the element does not intercalate. Once //released it returns to its original position.

var group = $ ('#sort-it ol.ollp') sortable ({ group: 'ollp', delay: 500, onDrop: function (item) { onDropImage (item, group); } });