title: Using JQuery to get text of a div that's a child of a header to replace a different header
body: <p>I'm trying to get the text contents of a .div('.child#') child of my event.target('h6.class'), and replace my other headers('h1.replacHeader#') using this script below...</p>
  
  <pre><code>$('h6.HeaderToBeClicked').click(function(event) { 
      var $target = $(this);
      $('.replaceHeader1').replaceWith("&lt;h1 class='replaceHeader1'&gt;" + $target.children(".child1").text() + "&lt;/h1&gt;");
      $('.replaceHeader2').replaceWith("&lt;h1 class='replaceHeader2'&gt;" + $target.children(".child2").text() + "&lt;/h1&gt;");
      });
  
  });
  
  HTML:
  &lt;div id="ReplaceTheseHeaders"&gt;
      &lt;h1 class='replaceHeader1'&gt;&lt;/h1&gt;
      &lt;h1 class='replaceHeader2'&gt;&lt;/h1&gt;
  &lt;/div&gt;
  &lt;div id="accordian" class="acc"&gt;
      &lt;?php $counter = 1; ?&gt;
      &lt;?php foreach ($tmpl-&gt;vars as $var) { ?&gt;
      &lt;h6 class="HeaderToBeClicked"&gt;&lt;a href="#"&gt;
      &lt;div class="counter"&gt;&lt;?php print $counter . "." ?&gt;&lt;/div&gt;
          &lt;div class="child1"&gt;&lt;?php print $var['title'];?&gt;&lt;/div&gt;
      &lt;div class="child2"&gt;&lt;?php print $var['name'];?&gt;&lt;/div&gt;
      &lt;/a&gt;&lt;/h6&gt;
  &lt;?php $counter = $counter+1; ?&gt;
      &lt;?php } ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I've noticed that .text() apparently doesn't apply to an event.target... So how could I go about achieving this?</p>