title: Accessing a child class from parent class javascript
body: <pre><code>&lt;td &lt;td class="upgrade_building b_wall"&gt;
      &lt;a href="#" class="building_tooltip d_0" tooltip="&lt;span class='icon header wood'&gt;&lt;/span&gt; 801 &lt;span class='icon header stone'&gt;&lt;/span&gt; 1846 &lt;span class='icon header iron'&gt;&lt;/span&gt; 320&lt;br /&gt;Población: 5&lt;br /&gt;Tiempo de construcción: 3:12:01"&gt;10
      &lt;/a&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>I'm making a script to perform a autoclick on the element "building_tooltip d_0" contained within a   "upgrade_building b_wall"
  I tried this code:</p>
  
  <pre><code>javascript:var list = document.getElementsByClassName("building_tooltip d_0");
  for (var i=0; i&lt;list.length; i++) list[i].click();
  </code></pre>
  
  <p>But in the DOM of the page there are other elements   with "building_tooltip d_0" I do not want to run, I just want to run the "upgrade_building b_wall".</p>
  
  <p>Can anybody help me?</p>