title: getting value of selected values of checkboxlist in javascript
body: <p>I have checkBoxList </p>
  
  <pre><code>&lt;asp:CheckBoxList ID="cheBoxTypeOfInc" runat="server" onchange="checkBoxchanged()"  CssClass="form-checkbox" Height="39px" Width="493px" RepeatDirection="Horizontal" RepeatColumns="1"&gt;
                   &lt;asp:ListItem Value="CommMotVehiAcci"&gt;Commercial Motor Vehicle Accident&lt;/asp:ListItem&gt;
  
                      &lt;asp:ListItem Value="EmpInjry"&gt;Employee Injury &lt;/asp:ListItem&gt;
  
                  &lt;/asp:CheckBoxList&gt;
  </code></pre>
  
  <p>and I am adding more Item to it as <code>addElement("InciRepo", "Incident Reporting");</code>
  and defination of addElement is as below :</p>
  
  <pre><code> function addElement(a, b) {
  
          var tableRef = document.getElementById('&lt;%= cheBoxTypeOfInc.ClientID %&gt;');
          var tableRow = tableRef.insertRow();
  
          var tableCell = tableRow.insertCell();
  
          var checkBoxRef = document.createElement('input');
          var labelRef = document.createElement('label');
  
          checkBoxRef.type = 'checkbox';
          checkBoxRef.id = a;
  
          labelRef.innerHTML = b;
          checkBoxRef.value = a;
          tableCell.appendChild(checkBoxRef);
          tableCell.appendChild(labelRef);
  
      }
  </code></pre>
  
  <p>I want to read the selected value  using Javascript as  </p>
  
  <pre><code>function checkBoxchanged()
      {
          debugger;
          var chebox = document.getElementById('&lt;%= cheBoxTypeOfInc.ClientID %&gt;');
          var checkboxesChecked = [];
          // loop over them all
          for (var i = 0; i &lt; checkboxes.length; i++) {
              // And stick the checked ones onto an array...
              if (checkboxes[i].checked) {
                  checkboxesChecked.push(checkboxes[i]);
              }
          }
  </code></pre>
  
  <p>but its not giving me list. In fact when i am looking for the selected item its not showing checked also.
  is i am missing something ? is there any other way to active this ? Please advice !!</p>