title: Access Span Inside Div by means of classname
body: <p>I need to access span inside div by using <code>document.getElementsByClassName()</code>.</p>
  
  <p>I have-</p>
  
  <pre><code>&lt;div class="PERSON"&gt;
      &lt;span class="name"&gt;Person_name&lt;/span&gt;
      &lt;span class="title"&gt;Person_title&lt;/span&gt;
      &lt;span class="team"&gt;Person_team&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I need to access all spans with class team within all divs with class PERSON. How do I do it?</p>
  
  <p>I have the following code - </p>
  
  <pre><code>function dispTeam(tname)
  {
     alert(tname);
     var e=document.getElementsByClassName("PERSON");
     for(var m=0;m&lt;e.length;m++)
     {
        if(e[m].document.getElementsByClassName("team").innerHTML.indexOf(tname)==-1)
        {
           e[m].style.display="none";
        }
        else
        {
           e[m].style.display="block";
        }
     }
  }
  </code></pre>
  
  <p>The alert is getting triggered but the elements are not getting displayed.</p>
  
  <p>NOTE: There are divs with class PERSON which do NOT have span with class team. I need to include those divs in this condition too.</p>
  
  <p>If they don't have span class team, those divs must not be displayed.</p>