title: JQuery: Appending Attribute Value to Each Element
body: <p>I am trying to append an additional url chunk to an existing attribute and simply update it.</p>
  <pre><code>$(&quot;img&quot;).each(function (i) {
      var originalSrc = $(&quot;img&quot;).attr('src');
      $(&quot;img&quot;).attr('src', 'http://www.domain-name.com/' + originalSrc);    
  });
  
  $(&quot;a&quot;).each(function (i) {
      var originalHref = $(&quot;a&quot;).attr('href');
      $(&quot;a&quot;).attr('href', 'http://www.domain-name.com/' + originalHref);    
  });
  </code></pre>
  <p>It is counting all elements and appending a long string to the final attribute.  I understand what's going on, but I'm not sure the correct way to go about this.  This is obviously wrong.</p>
  <p>Essentially, I'm scrubbing a remote page and I need to reset all relative connections to absolute.</p>