I have a page with an iframe (in the same domain) with lots of images with src="../../imageXX.gif"
I need to change those srcs to "../imageXX.gif"
I´m doing somthing like:
$('iframe').load(function() {
var src = $(this).contents().find('img').attr('src').replace('/../' ,'/');
$('img').attr('src', src);
})
CodePudding user response:
I think you mean
$('iframe').load(function() {
$(this).contents().find('img').each(function() {
let src = $(this).attr('src');
$(this).attr('src',src.replace('/../' ,'/'));
})
})