Код: Выделить всё
let Itinerary = [{placeid:'123',address:'Bordman'},
{placeid:'124',address:'Bardman'},
{placeid:'125',address:'Burdman'}]
Код: Выделить всё
[*]Head
[*]Bordman
[*]Bardman
[*]Burdman
[*]Footer
Код: Выделить всё
$(function() {
$("#cab_itenary").sortable({
cancel: ".unsortable",
start: function(evt, ui) {
ui.item.data('pos', ui.item.index());
}
,
stop: function(evt, ui) {
moveIndex(ui.item.data('pos'), ui.item.index())
}
});
});
function moveIndex(fromIndex, toIndex) {
const element=itenary.splice(fromIndex, 1)[0];
console.log(element);
itenary.splice(toIndex, 0, element);
}
jsfiddle
Подробнее здесь: https://stackoverflow.com/questions/785 ... of-objects