Reputation: 22323
Code works perfectly. Is it possible to track sortable item order and store in a variable each and every time an item changes position.
$('div.divContent ul').sortable({
'remove': function(event, ui) {
},
'create': function(event, ui) {
if ($(".widget-placeholder ui-droppable")); {
}
},
'placeholder': 'div.divContent ul',
'cursor': 'crosshair',
'connectWith': 'div.divContent ul',
'start': function(event, ui) {
$(".widget-placeholder ui-droppable").disableSelection();
$(ui.droppable).remove();
},
'stop': function(event, ui) {
if ($('div.divContent ul').length)) {
}
},
'cancel': function(event, ui) {
},
'sort': function(event, ui) {
if ($('ul li').length) {
}
}
});
Upvotes: 0
Views: 914
Reputation: 5316
You can use
$('li').index(ui.item);
to get the position of the current item. You must now choose which event to use this in.
Upvotes: 1