title: Comma separated list from checkbox values
body: <p>I've been digging around to try and get a list of comma separated values from a set of checkboxes. There have been lots of useful answers here, but I can't work out a final kink. My code is behaving oddly depending on whether or not the first checkbox is checked and I can't work out why (this is my first ever attempt at javascript!)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function updateTextArea() {
          var allVals = $('input.gift:checked').map( 
          function() {return this.value;}).get().join();
  
          $('#txtValue').val(allVals)
      }
      $(function () {
          $('#gift input').click(updateTextArea);
          updateTextArea();
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And here's the html that accompanies it.</p>
  
  <pre><code>&lt;fieldset id="gift"&gt;
      &lt;input type='checkbox' name='lFreeProductid' value='8840'
          id="lFreeProductid1" class="gift"&gt;
      &lt;/td&gt;
      &lt;td class="style42"&gt;64 SSG&lt;/td&gt;
      &lt;td class="style32"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
  
  
      &lt;tr id="tr2"&gt;
          &lt;td class="style33"&gt;&lt;input type='checkbox' name='lFreeProductid'
              value='420' id="lFreeProductid1" class="gift"&gt;&lt;/td&gt;
          &lt;td class="style41"&gt;Perfect D&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
  
  
      &lt;tr id="tr3"&gt;
          &lt;td class="style33"&gt;&lt;input type='checkbox' name='lFreeProductid'
              value='460' id="lFreeProductid1" class="gift"&gt;&lt;/td&gt;
          &lt;td class="style41"&gt;Soccer Attack&lt;/td&gt;
          &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/fieldset&gt;
  
  &lt;tr&gt;
      &lt;td class="style33"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td class="style41"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  
  
  &lt;textarea id="txtValue"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>I know this is the sort of question that's been asked a thousand times, but I can't seem to find a solution to this specific issue. Any help would be greatly appreciated.</p>