i have a ul, kinda like this:
<ul id="sortable">
<li data-name="name1">
<li data-name="name2">
<li data-name="name3">
</ul>
I am using jQuery sortable and i need to know, when there is a sort change, what is the order of the lis. I am using:
$("#sortable").sortable({
axis: 'y',
stop: function(evt, ui){
console.log($("#sortable").sortable('toArray'));
}
});
the problem with “toArray” is that it relies only on the unique ids of the items and i can’t use that attribute on those lis, for reasons.
Is there any way to make toArray, return an array with the data-attribute data-name instead of the id?
Thanks
Try
Working example