title: Getting the width of child element pure javascript
body: <p>Html:</p>
  
  <pre><code>&lt;div class="project-box"&gt;
   &lt;img src="img/ifix.jpg" class="thumbnail img-responsive"&gt;
     &lt;div class="hover-box"&gt;
       &lt;h2&gt;TITLE&lt;/h2&gt;
       &lt;p&gt;Description of title&lt;/p&gt;
     &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>javascipt:</p>
  
  <pre><code>window.onload = function(){
  
  var project = document.getElementsByClassName('project-box');
  img = project.getElementsByTagName('img');
    alert(img.clientWidth); 
  };
  </code></pre>
  
  <p>I'm trying to get the img width and eventually the img height using pure JavaScript I know this is a lot easier with jQuery but I want to do it using only JavaScript.
  EDIT:
  I realized I was not specifying the array for the img and project </p>
  
  <p>working js:</p>
  
  <pre><code>window.onload = function(){
  
  var project = document.getElementsByClassName('project-box');
  img = project[0].getElementsByTagName('img');
   alert(img[0].offsetWidth);
  };
  </code></pre>