Answer the question
In order to leave comments, you need to log in
How to get sorted array in jquery?
I connect the framework ( https://code.jquery.com/ui/1.12.1/jquery-ui.js ), use sortable for the list. When dragging, an array sortArray should be formed, where order-id is the number in the list, slider-id is the id of the record in the database.
On the mouseup event, I get the old array order, then change again and get the previous array order. How to get up-to-date data? Why is there such a blockage?
var sortArray = new Array();
$("#sortable").on("mouseup", "li", function () {
var i = 0;
$("#sortable")
.find('input[name="slider-id"]')
.each(function () {
++i;
sortArray[i] = $(this).attr("value");
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question