How to pass sortable order to hidden field in jQuery?
问题 I'm trying to pass the values of a sortable list to a hidden field using the code below, but no luck: <script> $(document).ready(function(){ $(function() { $( "#sortable1, #sortable2" ).sortable({ connectWith: ".connectedSortable" }).disableSelection(); }); var idsInOrder = []; $("#form_quest").submit(function(){ $("ul#sortable2 li.card").each(function() { idsInOrder.push($(this).attr('title')); }); $("#sort_order").val(idsInOrder); }); }); </script> html hidden field: <input type="hidden"