title: How to get checked checkbox inside in div using jquery?
body: <p>I have list of checkbox inside a div few are checked. i want to change background color green of div when if checkbox is checked.</p>
  
  <p>And On non checked checkbox background color should be gray.</p>
  
  <p>HTML Code :</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;label&gt;
          &lt;div class="col s3" style="padding:10px" id="div39"&gt;
              &lt;div&gt;
                  &lt;input type="checkbox" name="chk39" value="39" checked=""&gt;
                  &lt;span&gt;Featured Project&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/label&gt;
      &lt;label&gt;
          &lt;div class="col s3" style="padding:10px" id="div40"&gt;
              &lt;div&gt;
                  &lt;input type="checkbox" name="chk40" value="40"&gt;
                  &lt;span&gt;Specials/Discounts&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Jquery Code:</p>
  
  <pre><code>var check = 1;
      $('div').find('input[type=checkbox]').click(function(event) {
          var val = $(this).val();
          if(check==1)
          {
              $('#div'+val).css({'background-color': 'lightgreen'});
              check=0;
          }else{
              $('#div'+val).css({'background-color': 'lightgray'});
              check=1;
          }
      });
  
  $(document).ready(function($) {
          var selected = [];
          $('input[type=checkbox] :checked').each(function() {
              alert('asd');
              selected.push($(this).attr('value'));
          });
  });
  </code></pre>