title: Moving attributes with Jquery in DOM tree
body: <p>I'm trying to get the href attribute of an element, fairly deep inside the tree.
  This is the code i'm so far tweaking</p>
  
  <pre><code>$('.widget-pSidebar &gt; ul &gt; li &gt; article &gt; section &gt; div &gt; article &gt; a').each(function () {
          var path = $(this).parent().find('footer').children().children().attr('href');
          alert(path);
          $(this).attr('href', path);
      });
  </code></pre>
  
  <p>while this is the tree</p>
  
  <pre><code>&lt;a&gt;
      &lt;img&gt;
  &lt;/a&gt;
  &lt;footer&gt;
      &lt;h1&gt;
          &lt;a&gt;
      &lt;/h1&gt;
  </code></pre>
  
  <p>I want to take the href from the last  and put it into the first one.</p>
  
  <p>EDIT: I remade the code, and i can access a, but unfortunately i copy the same link over &amp; over again.</p>