I'm trying to update my image source using jquery. To do it, I am calling .load
function that will return a string which in turn will be used to replace the image source.
srcResult value is new/icon.png:
<script>
var iconLinkURL = "Users/NewIcon";
var srcResult = $("#iconImage").children('img').load(iconLinkURL);
$("#iconImage").children('img').attr('src', srcResult);
</script>
HTML Side
<a id="iconImage"><img src="old/address.png"></img></a>
What happens is that when the javascript is loaded, the image is loaded like this:
<a id="iconImage"><img src="[object Object]">new/icon.png</img></a>
Am I missing something hence the issue is persisting?
<img src="old/address.png"/>not<img src="old/address.png"></img>