title: How to pass sortable order to hidden field in jQuery?
body: <p>I'm trying to pass the values of a sortable list to a hidden field using the code below, but no luck:</p>
  
  <pre><code>&lt;script&gt;
     $(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);
    });  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>html hidden field:</p>
  
  <pre><code>&lt;input type="hidden" name="sort_order" id="sort_order" value=""/&gt;
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance.</p>