title: Checked parent checkbox if all child checkboxes are checked
body: <p>I am trying to check parent node if all child node are checked. I have found some solutions on this particular topic as well. But, may be because of different nesting levels I am unable to achieve this.</p>
  
  <p>Upto this point, I am able to check / uncheck child node according to the parent node. However, reverse is not working i.e, checking parent node if all child nodes are checked.</p>
  
  <h2>My Html</h2>
  
  <pre><code>&lt;ul class="treeview"&gt;
     &lt;li id="li_1" class="contains-items"&gt;
        &lt;div class="checkbox"&gt;
           &lt;input id="1" type="checkbox" value="1" name="categories[]"&gt;
           &lt;label for="1"&gt;
           Floor
           &lt;/label&gt;
        &lt;/div&gt;
        &lt;ul&gt;
           &lt;li class="li_1"&gt;
              &lt;div class="checkbox"&gt;
                 &lt;input id="4" type="checkbox" value="4" name="categories[]"&gt;
                 &lt;label for="4"&gt;
                 1st Floor
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/li&gt;
           &lt;li class="li_1"&gt;
              &lt;div class="checkbox"&gt;
                 &lt;input id="5" type="checkbox" value="5" name="categories[]"&gt;
                 &lt;label for="5"&gt;
                 2nd Floor
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/li&gt;
           &lt;li class="li_1"&gt;
              &lt;div class="checkbox"&gt;
                 &lt;input id="6" type="checkbox" value="6" name="categories[]"&gt;
                 &lt;label for="6"&gt;
                 3rd Floor
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/li&gt;
        &lt;/ul&gt;
     &lt;/li&gt;
     &lt;li id="li_2"&gt;
        &lt;div class="checkbox"&gt;
           &lt;input id="2" type="checkbox" value="2" name="categories[]"&gt;
           &lt;label for="2"&gt;
           Rent
           &lt;/label&gt;
        &lt;/div&gt;
     &lt;/li&gt;
     &lt;li id="li_3" class="contains-items"&gt;
        &lt;div class="checkbox"&gt;
           &lt;input id="3" type="checkbox" value="3" name="categories[]"&gt;
           &lt;label for="3"&gt;
           View
           &lt;/label&gt;
        &lt;/div&gt;
        &lt;ul&gt;
           &lt;li class="li_3"&gt;
              &lt;div class="checkbox"&gt;
                 &lt;input id="7" type="checkbox" value="7" name="categories[]"&gt;
                 &lt;label for="7"&gt;
                 Pool View
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/li&gt;
           &lt;li class="li_3"&gt;
              &lt;div class="checkbox"&gt;
                 &lt;input id="8" type="checkbox" value="8" name="categories[]"&gt;
                 &lt;label for="8"&gt;
                 Mountain View
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/li&gt;
           &lt;li class="li_3"&gt;
              &lt;div class="checkbox"&gt;
                 &lt;input id="9" type="checkbox" value="9" name="categories[]"&gt;
                 &lt;label for="9"&gt;
                 Courtyard
                 &lt;/label&gt;
              &lt;/div&gt;
           &lt;/li&gt;
        &lt;/ul&gt;
     &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Jquery</p>
  
  <pre><code> $('input[type=checkbox]').change(function(){
              // if is checked
              if($(this).is(':checked')){
  
                  // check all children
                  $(this).parent().siblings().find('li input[type=checkbox]').prop('checked', true);
  
                  //if all siblings are checked, check its parent checkbox
                  if($(this).parent().siblings('li input[type=checkbox]').is(":checked")) {  
                      console.log('all siblings checked');
                      //check its parent checkbox
                  }else{
                      console.log('not all siblings checked');
                  }
  
              } else {
  
                  // uncheck all children
                  $(this).parent().siblings().find('li input[type=checkbox]').prop('checked', false);
  
              }
  
          });
  </code></pre>
  
  <p>However, even doing this it is always consoling <code>not all sibilings checked</code> even if all are checked.</p>