I am trying to replace an img path in jquery (injecting into a remote page)
replace example.com/thumbs
with ex
This gets the value, but doesn't set it back to the attribute:
$("img").attr("src").replace("thumbs", "images");
That requires another step, something like:
var newSrc = $("img").attr("src").replace("thumbs", "images");
$("img").attr("src", newSrc);
Or, if you want a single line:
$("img").attr("src", $("img").attr("src").replace("thumbs", "images"));