title: get element by class name
body: <p>I wanna know how to get element by class name, this is html code</p>
  
  <pre><code>&lt;div class="header" id="parent"&gt;
  
          &lt;div class="child"&gt;&lt;/div&gt;
              &lt;div class="head_container"&gt;
                  &lt;img src="images/logo_picture.png" alt="" title="" class="logopic" /&gt;
                  &lt;img src="images/logo_text.png" alt="" title="" class="logotext" /&gt;
                  &lt;img src="images/head_line.jpg" title="" alt="" class="head_line" /&gt;
  
              &lt;/div&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p>This is jquery and this is problem, I have code with getEelementById, but I wanna using getElementByClass. This is method to use opacity on any element and prevent the child elements form inheriting the opacity. I will use five or six time class parent, so I need getElementByClass method</p>
  
  <pre><code>$(document).ready(function () {
  
  function thatsNotYoChild(parentID) {
  
      var parent           = document.getElementById(parentID),
          children         = parent.innerHTML,
          wrappedChildren  = '&lt;div id="children" class="children"&gt;' + children + '&lt;/div&gt;',
          x, y, w, newParent, clonedChild, clonedChildOld;
  
      parent.innerHTML = wrappedChildren;
      clonedChild = document.getElementById('children').cloneNode(true);
      document.getElementById('children').id = 'children-old';
      clonedChildOld = document.getElementById('children-old');
      newParent = parent.parentNode;
  
      newParent.appendChild(clonedChild);
      clonedChildOld.style.opacity = '0';
      clonedChildOld.style.filter = 'alpha(opacity=0)';
  
      function doCoords () {
        x = clonedChildOld.getBoundingClientRect().left;
        y = clonedChildOld.getBoundingClientRect().top;
        if (clonedChildOld.getBoundingClientRect().width) {
          w = clonedChildOld.getBoundingClientRect().width; // for modern browsers
        } else {
          w = clonedChildOld.offsetWidth; // for oldIE
        }
  
        clonedChild.style.position = 'absolute';
        clonedChild.style.left = x + 'px';
        clonedChild.style.top = y + 'px';
        clonedChild.style.width = w + 'px';
      }
  
      window.onresize = function () {
  
        doCoords();
  
      };
  
      doCoords();
  
  }
  
  
  thatsNotYoChild('parent');
  });
  </code></pre>