title: Get the value of items in checkboxlist and save in hiddenfield
body: <p>I have a checkboxlist.</p>
  
  <pre><code>&lt;asp:CheckBoxList ID="cblList" runat="server" RepeatDirection="Horizontal"&gt;                                                 
  &lt;asp:ListItem Value="S04"&gt;1&lt;/asp:ListItem&gt;
  &lt;asp:ListItem Value="S08"&gt;2&lt;/asp:ListItem&gt;
  &lt;asp:ListItem Value="S09"&gt;3&lt;/asp:ListItem&gt;
  &lt;asp:ListItem&gt;All&lt;/asp:ListItem&gt;
   &lt;/asp:CheckBoxList&gt;
  </code></pre>
  
  <p>and hidden field</p>
  
  <pre><code>    &lt;asp:HiddenField ID="hddnValue" runat="server" /&gt;
  </code></pre>
  
  <p>I want to store the selected value of checkboxlist in HiddenField.</p>
  
  <p>Generated HTML</p>
  
  <pre><code>&lt;td&gt;&lt;input id="ctl00_ContentPlaceHolder1_cblList_0" type="checkbox" name="ctl00$ContentPlaceHolder1$cblList$0" /&gt;&lt;label for="ctl00_ContentPlaceHolder1_cblList_0"&gt;1&lt;/label&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input id="ctl00_ContentPlaceHolder1_cblList_1" type="checkbox" name="ctl00$ContentPlaceHolder1$cblList$1" /&gt;&lt;label for="ctl00_ContentPlaceHolder1_cblList_1"&gt;2&lt;/label&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input id="ctl00_ContentPlaceHolder1_cblList_2" type="checkbox" name="ctl00$ContentPlaceHolder1$cblList$2" /&gt;&lt;label for="ctl00_ContentPlaceHolder1_cblList_2"&gt;3&lt;/label&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;input id="ctl00_ContentPlaceHolder1_cblList_3" type="checkbox" name="ctl00$ContentPlaceHolder1$cblList$3" /&gt;&lt;label for="ctl00_ContentPlaceHolder1_cblList_3"&gt;4&lt;/label&gt;&lt;/td&gt;
  </code></pre>
  
  <p>I tried</p>
  
  <pre><code>    $(function() {
      $('#ctl00_ContentPlaceHolder1_btnConfirm').click(function() {
          debugger;
          var val = [];
          $(':checkbox:checked').each(function(i) {
              val[i] = $(this).val();
          });
      });
  });
  </code></pre>
  
  <p>without any luck. Please Help.</p>
  
  <p>Thank you,</p>
  
  <p>Rahul</p>