title: Hide Parent Div if Child Table is hidden (display: none)
body: <p>I've tried searching all over StackOverflow and Google and I've found ideas that I thought would work but nothing seems to help!</p>
  
  <p>I'm working in SugarCRM Professional 6.5.5 and I'm trying to hide the parent div of a child table if the table is hidden (display: none) using jQuery but I'm not having much luck.</p>
  
  <p>For example, in the code below I'm trying to hide <code>&lt;div id="detailpanel_5" class="detail view detail508 expanded"&gt;</code> because the child table <code>&lt;table id="LBL_EDITVIEW_PANEL6" class="panelContainer" cellspacing="0" style="overflow: hidden; height: 0px; display: none;"&gt;</code> is hidden.</p>
  
  <p>I am able to successfully hide the parent div with <code>$('#LBL_EDITVIEW_PANEL6').parent().hide();</code> however the problem is that there are a lot of tables hidden on each page, and the view is dynamic -- not every page will have the same tables hidden. </p>
  
  <p>So what I want jQuery to do is go through the page after it is loaded and hide only the parent div of the child table that is hidden.</p>
  
  <p>I've tried using something like: <code>$(":hidden").parent().hide();</code> to search for any hidden elements but that hides the entire page (the screen is completely white).  I've tried <code>$("table:hidden").parent().hide();</code> but that doesn't seem to do anything.</p>
  
  <p>Apologies if I left out any details that would be needed to help with an answer.  I will be glad to offer any more info if it is needed.  Hopefully it's something very small I am overlooking.</p>
  
  <p>A small snippet of the HTML is below:</p>
  
  <pre><code>&lt;div class="yui-content"&gt;
      &lt;div id="tabcontent0"&gt;
          &lt;div id="detailpanel_1" class="detail view detail508 "&gt;
          &lt;div id="detailpanel_2" class="detail view detail508 expanded"&gt;
          &lt;div id="detailpanel_3" class="detail view detail508 expanded"&gt;
          &lt;div id="detailpanel_4" class="detail view detail508 expanded"&gt;
              &lt;h4&gt;
              &lt;table id="LBL_EDITVIEW_PANEL7" class="panelContainer" cellspacing="0"&gt;
              &lt;script type="text/javascript"&gt;
          &lt;/div&gt;
          &lt;div id="detailpanel_5" class="detail view detail508 expanded"&gt;
              &lt;h4&gt;
              &lt;table id="LBL_EDITVIEW_PANEL6" class="panelContainer" cellspacing="0" style="overflow: hidden; height: 0px; display: none;"&gt;
  </code></pre>