title: Add values to input - jQuery
body: <p>On my website, I have a list of tickets. In top of that list, I have this checkbox, that can check ALL checkboxes in the list:</p>
  
  <pre><code>&lt;input type="checkbox" id="checkall"  class="checkall" name="checkall"&gt;
  </code></pre>
  
  <p>This checkbox, checks all other checkboxes with the following jQuery:</p>
  
  <pre><code>$(document).ready(function(){
      $('#checkall').toggle(function(){
          $('input:checkbox').attr('checked','checked');
          $(this).val('uncheck all')
      },function(){
          $('input:checkbox').removeAttr('checked');
          $(this).val('check all');        
      })
  })
  
  
  $('input:checkbox').click(function() {
      $("#userInfo").toggle(!($('input:checkbox:checked').length == 0));  
  });
  
  $('#close').click(function() {
      $("#userInfo").hide();
      $('input:checkbox').removeAttr('checked');  
  });
  </code></pre>
  
  <p><strong>Although</strong>, I also wish to have all the selected checkbox values put into my form. I use this code for that:</p>
  
  <pre><code>function updateTextArea() 
      {
           var allVals = [];
           $('#c_b :checked').each(function(){
             allVals.push($(this).val());
           });
           jQuery('#ticketIds').val(allVals);  
      }
      $(function() 
      {
            $('#c_b input').click(updateTextArea);
            updateTextArea();
      });
  </code></pre>
  
  <p>And here is my form:</p>
  
  <pre><code>&lt;form method="post" name="edit"&gt;  
     &lt;input type="hidden" id="ticketIds" name="ticketIds" value=""&gt;       
     &lt;input type="submit" class="button gray" value="Okay, do it" name=""&gt; &lt;a href="#" id="close"&gt;Close&lt;/a&gt;&lt;/form&gt;
  </code></pre>
  
  <p>My problem is, whenever I use the "check all" checkbox, NO values is added to the #ticketIds. ONLY when I check each checkbox myself, the values are added. </p>
  
  <p>How can I do, so it works both ways?</p>