title: Targeting child elements within nested for each loops in jQuery
body: <p>My question is exactly the same as <a href="https://stackoverflow.com/q/16346206/5445777">Targeting $(this) within nested for each loops in jQuery</a> but I can't make it work for some reason. Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
      var rows=$('.row');
      var count = 0;
      $.each(rows, function() {
          console.log(".row "+count++);
          var row = $(this);
          var cells = row.find('span.RIF_Field');
          if (cells.length &gt; 0) {
              console.log("cells "+cells.length);
              var hidden = true;
              $.each(cells, function() {
                  if(!$(this).is(':hidden')) {
                      console.log($(this).id + " is visible");
                      hidden = false;
                  }
              });
              if (hidden)  {
                  console.log("nothing is visible");
                  row.hide();
              }
          }
      });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="container"&gt;
      
  &lt;div class="row"&gt;&lt;div class="col-sm-6"&gt;&lt;br style="clear:both;"&gt;
  &lt;div class="RIF_Field RIF_Street" id="yourStreet" style="float:left;width:200px;"&gt;&lt;label class="fldLbl" id="yourStreetLabel"&gt;Address Line 1:&lt;/label&gt;&lt;br&gt;
  &lt;span style="white-space: nowrap;"&gt;&lt;input id="yourStreetValue" maxlength="35" name="yourStreet" size="32" style="width:200px;" type="text"&gt;&lt;img alt="" height="9" id="yourStreetReqdImg" src="/img/1.gif" width="11"&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="col-sm-6"&gt;&lt;br style="clear:both;"&gt;
  &lt;div class="RIF_Field RIF_Addr2" id="yourAddr2" style="float:left;width:200px;"&gt;&lt;label class="fldLbl" id="yourAddr2Label"&gt;Address Line 2:&lt;/label&gt;&lt;br&gt;
  &lt;span style="white-space: nowrap;"&gt;&lt;input id="yourAddr2Value" maxlength="35" name="yourAddr2" size="32" style="width:200px;" type="text"&gt;&lt;img alt="" height="9" id="yourAddr2ReqdImg" src="/img/1.gif" width="11"&gt;&lt;/span&gt;&lt;br&gt;
  &lt;span class="RIF_description"&gt;Test&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
      
      
  &lt;div class="row"&gt;&lt;div class="col-sm-6"&gt;&lt;br style="clear:both;"&gt;
  &lt;div class="RIF_Csp3" id="yourCsp3" style="float:left;"&gt;&lt;span class="RIF_Field RIF_State" id="yourState" style="display: none;"&gt;&lt;label class="fldLbl" id="yourStateLabel"&gt;Other Address Information:&lt;/label&gt;&lt;br&gt;
  &lt;span style="white-space: nowrap;"&gt;&lt;input type="text" size="15" maxlength="15" id="yourStateValue" name="yourState" onchange="null" onfocus="null" onblur="null" tabindex="0" class="ui-autocomplete-input" autocomplete="off"&gt;&lt;img alt="" height="9" id="yourStateReqdImg" src="/img/1.gif" width="11"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="col-sm-6"&gt;&lt;div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
      
   &lt;div class="row"&gt;&lt;div class="col-sm-6"&gt;&lt;br style="clear:both;"&gt;
  &lt;div class="RIF_Field RIF_Phone" id="yourPhone" style="float:left;width:300px;"&gt;&lt;label class="fldLbl" id="yourPhoneLabel"&gt;Telephone:&lt;/label&gt;&lt;br&gt;
  &lt;span style="white-space: nowrap;"&gt;&lt;input id="yourPhoneValue" maxlength="15" name="yourPhone" size="15" style="width:300px;" type="text"&gt;&lt;img alt="" height="9" id="yourPhoneReqdImg" src="/img/1.gif" width="11"&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div class="RIF_Field RIF_Extension" id="yourExtension" style="float:left;width:100px;"&gt;&lt;label class="fldLbl" id="yourExtensionLabel"&gt;Ext.:&lt;/label&gt;&lt;br&gt;
  &lt;span style="white-space: nowrap;"&gt;&lt;input id="yourExtensionValue" maxlength="5" name="yourExtension" size="5" style="width:100px;" type="text"&gt;&lt;img alt="" height="9" id="yourExtensionReqdImg" src="/img/1.gif" width="11"&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="col-sm-6"&gt;&lt;br style="clear:both;"&gt;
  &lt;div class="RIF_Field RIF_Email" id="yourEmail" style="float:left;width:400px;"&gt;&lt;label class="fldLbl" id="yourEmailLabel"&gt;E-mail:&lt;/label&gt;&lt;br&gt;
  &lt;span style="white-space: nowrap;"&gt;&lt;input id="yourEmailValue" maxlength="50" name="yourEmail" size="32" style="width:400px;" type="text"&gt;&lt;img alt="" height="9" id="yourEmailReqdImg" src="/img/1.gif" width="11"&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;   
      
      
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am trying to hide the .row element that has all cells hidden. What am I doing wrong?</p>