title: Jquery: Append a Form Input Value (.val)
body: <p>I am trying trying to write a string of multiple values depending on whether specific checkboxes are checked. i.e.</p>
  
  <pre><code>$('#submit').click(function() {
    if ($('#box1').attr('checked')) {
      $('#MyInput').val('box1 ');
      alert('1');
    }
  
    if ($('#box2').attr('checked')) {
      $('#MyInput').val('box2 ');
      alert('2');
    }
  });
  </code></pre>
  
  <p>The return I am looking for in this case would be '1 2', however only the second value is written in the input field.</p>
  
  <p>The alerts tell me that both events in the argument are firing. Is there another method for appending values?</p>