title: Javascript - Get child's text value
body: <p>How can I get the text value from an elements's child?</p>
  
  <p>Say I have this code on a page:</p>
  
  <pre><code>&lt;div class='geshitop'&gt;
    &amp;#91; CODE &amp;#93; &amp;#91; &lt;a href="#" onclick="javascript:copy(); return false;"&gt;PLAIN-TEXT&lt;/a&gt; &amp;#93;
  &lt;/div&gt;
  &lt;div class='geshimain'&gt;
    &lt;pre&gt;&lt;div class="text" style="font-family:monospace;"&gt;Code goes here...&lt;/div&gt;&lt;/pre&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The function <code>copy()</code>:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function copy() {
      var text = this.parent.getElementsByName("text");
      var code = text[0].value;
      var popup = window.open("", "window", "resizeable,width=400,height=300");
      popup.document.write("&lt;textarea name='code' cols='40' rows='15'&gt;&lt;/textarea&gt;");
      popup.code.value = code;
  }
  </code></pre>
  
  <p></p>
  
  <p>How would I go about getting that child's data: the <code>&lt;div class "text"&gt;</code>. How can I get that from the parent?</p>
  
  <hr>
  
  <p>I'm still having problems. If there is two codeboxes on one page, then it does not work. Remember, I am unable to use ID's. It must be classes.</p>
  
  <p>If I was able to use jQuery this would be easy.</p>