Reputation: 761
I have a link : http://fakedomain.net/path
I want to replace dynamically the link with the current domain name like this : http://currentdomain.com/path
$('.link a').each(function(){
this.href = this.href.replace('http://fakedomaine.net/', WHAT_GOES_HERE);
});
But I am blocked at this point
Upvotes: 0
Views: 234
Reputation: 177940
Try this
this.href = this.href.replace('http://fakedomaine.net',
location.protocol+"//"+location.host);
Upvotes: 2