title: Javascript how to add style="display:none" to <div> by checking <li> inline style?
body: <p>Javascript check how to add <code>style="display:none"</code> to <code>&lt;div&gt;</code> by checking <code>&lt;li&gt;</code> inline style ?</p>
  
  <ul>
  <li>As per above code by default all <code>&lt;li&gt;</code> having <code>style="display:none"</code>.</li>
  <li>Now I want javascript should check all <code>&lt;li&gt;</code> as <code>style="display:none"</code>.</li>
  <li>If all <code>&lt;li&gt;</code> having <code>style="display:none"</code> then <code>&lt;div&gt;</code> Food also render as <code>&lt;div style="display:none"&gt;</code> Food</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>HTML code:
  
  &lt;div&gt; Food &lt;!-- Main Category --&gt;
   &lt;ul&gt; 
        &lt;li style="display:none"&gt; Pizza &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Falafel &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Donuts &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Burger &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Cheese Sandwich &lt;/li&gt;  &lt;!-- Category Child Item --&gt;
   &lt;/ul&gt;
  
  &lt;/div&gt;
  
  Require - HTML code output by javascript:
  
  &lt;div style="display:none"&gt; Food &lt;!-- Main Category --&gt;
   &lt;ul&gt; 
        &lt;li style="display:none"&gt; Pizza &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Falafel &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Donuts &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Burger &lt;/li&gt;    &lt;!-- Category Child Item --&gt;
        &lt;li style="display:none"&gt; Cheese Sandwich &lt;/li&gt;  &lt;!-- Category Child Item --&gt;
   &lt;/ul&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>