title: how to know weather checkbox checked or not with javascript
body: <pre><code>function checkAll(custId){
          var id;
          if(document.getElementById(custId).checked == true){
          &lt;%for (CustomerGroup custGroup : customerGroupList) {%&gt;
  
              if(custId==&lt;%=custGroup.getCustomerGroupId()%&gt;){
                  &lt;%List&lt;Account&gt; list = accountDelegate
                      .findAccountEntityByGroupId(custGroup
                              .getCustomerGroupId());
              for (Account account : list) {%&gt;
                          id=&lt;%=account.getAccountId()%&gt;
                          document.getElementById(id).checked=true;
                  &lt;%}%&gt;
              }
      &lt;%}%&gt;
      }else {
          &lt;%for (CustomerGroup custGroup : customerGroupList) {%&gt;
  
              if(custId==&lt;%=custGroup.getCustomerGroupId()%&gt;){
              &lt;%List&lt;Account&gt; list2 = accountDelegate
                      .findAccountEntityByGroupId(custGroup
                              .getCustomerGroupId());
              for (Account account : list2) {%&gt;
                          id=&lt;%=account.getAccountId()%&gt;
                          document.getElementById(id).checked=false;
              &lt;%}%&gt;
      }
      &lt;%}%&gt;
  }
  }
  </code></pre>
  
  <p>Here I have passed custId as a id of checkbox.Problem here is if(document.getElementById(custId).checked == true</p>
  
  <p>each time this condition will evaluate to false and thus control goes on else part.
  so how can i know wether checkbox is cheched or not ?.</p>