0

I´m trying to serialize array created from list (ul) and include it on input value, how can i do this?

My actual code take the list element text as value and the original position.

<script>
     $(function () {
            $("#opciones").sortable();
            $("#opciones").disableSelection();
            updateOrder();
            $("#sortButton").click(sortClick);
        });

        $('#opciones').sortable().bind('sortupdate', function () {
            updateOrder();
        });
        function updateOrder() {
            var orderArray = [];

            $("#opciones li").each(function (i, el) {
                orderArray.push($(el).text());
                orderArray.push($("li")[i+1].className.slice(5));
            });

            $("#display").text(orderArray.join(" "));


        }

       function sortClick() {
            updateOrder();

            $("#display").text("click: " + $("#display").text());
        }
</script>
No-NaMe
  • 13
  • 5

0 Answers0