title: checkboxes not working independently
body: <p>My js function almost works but the checkboxes are not working quite independently:</p>
  
  <p>UPDATE: I fixed this by adding parent='NULL'; at the end of the function.  Could someone explain what's going on???</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function detectDiv(obj) {
    var parent = obj.parentElement;
    console.log(parent.id);
    
    
     $('input:checkbox').change(function(){
      if($(this).is(":checked")) {
          $("#"+parent.id).removeClass("grey100");
      } else {        $("#"+parent.id).addClass("grey100");
      }
  
      parent='NULL';
  });
  
    
     
    
    
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.grey100 {
      
              opacity: 0.5;
  }
  
  img{
  width:100px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;div &gt;
  &lt;table&gt;
     &lt;tr&gt;
        &lt;td id='img1' class='grey100'&gt;
  &lt;img src="https://res.cloudinary.com/rss81/image/upload/gw.jpg"&gt;&lt;br&gt;
  &lt;input type="checkbox" onclick="detectDiv(this)" &gt;
        &lt;/td&gt;
        &lt;td id='img2' class='grey100'&gt;
  &lt;img src="https://res.cloudinary.com/rss81/image/upload/gw.jpg"&gt;&lt;br&gt;
  &lt;input type="checkbox"  onclick="detectDiv(this)" &gt;
        &lt;/td&gt;
        &lt;/tr&gt;
   &lt;/table&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>