title: How to select all the input of child of ul list when parent input [checkbox] is chekced?
body: <p>I want to check all the child input of list when parent input [checkbox] is checked.</p>
  
  <pre><code>&lt;dd id="space_content"&gt;
  &lt;ul&gt;
      &lt;li parent-id="0" li-id="16"&gt;&lt;input type="checkbox" value="16"/&gt;Anthropology Department 
      &lt;ul&gt;
          &lt;li parent-id="16" li-id="18"&gt;&lt;input type="checkbox" value="18"/&gt;Anthropology Faculty Collections
          &lt;/li&gt;
          &lt;li parent-id="16" li-id="23"&gt;&lt;input type="checkbox" value="23"/&gt;Shared Collections&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/li&gt;
      &lt;li parent-id="0" li-id="45"&gt;&lt;input type="checkbox" value="45"/&gt;Center for asdf on Vermont&lt;/li&gt;
  &lt;li parent-id="0" li-id="19"&gt;&lt;input type="checkbox" value="19"/&gt;Center for Research on Vermont
      &lt;ul&gt;
          &lt;li parent-id="19" li-id="24"&gt;&lt;input type="checkbox" value="24"/&gt;Collections for Testing
              &lt;ul&gt;
                 &lt;li parent-id="24" li-id="25"&gt;&lt;input type="checkbox" value="25"/&gt;Geology Department
                  &lt;/li&gt; 
              &lt;/ul&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/li&gt;
  &lt;/ul&gt;
  &lt;/dd&gt;
  </code></pre>
  
  <p>So far this is what I did but could not go any further.</p>
  
  <pre><code>$(function(){    
      $("#space_content &gt; ul &gt; li &gt; input").click(function(){
  
         if($(this).is(':checked')){
             var $parent = $("#space_content &gt; ul &gt; li").children("ul");
             if($parent.has('input')){
                 $parent.children('input').attr('checked','checked');
             }
  
          }
      }); 
  });
  </code></pre>