Hey guys - I'm trying to append an additional url chunk to an existing attribute and simply update it.
$("img").each(function (i) {
var originalSrc = $("img").attr('src');
$("img").attr('src', 'http://www.domain-name.com/' + originalSrc);
});
$("a").each(function (i) {
var originalHref = $("a").attr('href');
$("a").attr('href', 'http://www.domain-name.com/' + originalHref);
});
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.
Essentially, I'm scrubbing a remote page and I need to reset all relative connections to absolute.
Thanks! :-)