title: Getting Checkbox in JavaScript or JQuery Value While OnClick
body: <p>I had a Checkbox I need to get the value of checkbox of while checked. either in JavaScript or jquery. I have placed my ASPX Code below. that Should Work in IE, While I am trying it is Showing response as "on" rather than value.</p>
  
  <p>ASPX code:</p>
  
  <pre><code>&lt;asp:TemplateField&gt;
      &lt;HeaderTemplate&gt;
          &lt;asp:CheckBox ID="CHK_STY_ALL" 
                        runat="server" 
                        onclick="javascript:Selectallcheckbox(this);" /&gt;
      &lt;/HeaderTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:CheckBox ID="CHK_STY" 
                        runat="server" 
                        onclick="javascript:SelectallColorsForStyle(this,value);" 
                        CssClass="checkboxselection" 
                        Text='&lt;%#Eval("STY_NBR")%&gt;' /&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>JavaScript and JQuery :</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
      function Selectallcheckbox(val) {
          if (!$(this).is(':checked')) {
              $('input:checkbox').prop('checked', val.checked);
          } else {
              $("#chkroot").removeAttr('checked');
          }
      }
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      function SelectallColorsForStyle(e,val) {
          var IDValue = $(e).attr('id');
  
          var StyleNumber = document.getElementById(IDValue).value;
          alert(StyleNumber);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/2garQ.png" alt="enter image description here"></p>
  
  <p>Showing value as "ON" rather than the original value displaying aside of checkbox.</p>