Reputation: 74008
I need to modify var absolute
to use var y
instead of a static value xxxxxx.
I have problem with js escpainig.
var y = 'http://www.mysite.com';
var resp = '<div><img src="smiley1.gif"></div><div><img src="smiley2.gif"></div><div><img src="smiley3.gif"></div>';
var re = /src=\"/gi;
var absolute = "src=\"xxxxxx\/"; // replace xxxxxx with value from variable y
resp = resp.replace(re, absolute);
trying
var absolute = "src=\"+ y +/";
does not work.
Any idea what is wrong?
Upvotes: 0
Views: 57
Reputation: 43419
I don't see why you need the (back)slash for. Use simple quote instead:
var absolute = 'src="'+ y +'"';
Upvotes: 1