I have a div that exists only in memory that may contain zero or more images. I'm trying the change the src of thouse images using JQuery find, the problem is that even though i manager to set the src of each img the the content of the div remains unchanged.
function contentWithReplacedImages(divContent){
console.log(divContent);//I get <div class='editable singleColumnElement'><p>asdasd ad a dasd ad<br/></p><p><img/> <br/></p></div>
$(divContent).find("img").each(function(index){
$(this).attr({
'src':"imgSrc"
});
console.log($(this).attr('src'));//I get "imgSrc"
});
console.log(divContent); //divContent remains unchanged.
}
var myNewString = contentWithReplacedImages(divContent);console.log(divContent);of my function and it's the same as my input