I wanted to update the img src rendered in wordpress media library
<a href="https://sample/group/wp-admin/post.php?post=159&action=edit" title="Edit “NTPIII_Banner_41620134.jpg”">
<img src="http://sample/group/files/2014/01/NTPIII_Banner_41620134.jpg" class="attachment-80x60" alt="NTPIII_Banner_41620134.jpg" /> </a>
I wanted to replace HTTP to HTTPS as image is not showing when the src is HTTP
Try this:
$('img').each(function(){
var newSrc = $(this).attr('src').replace('http', 'https');
$(this).attr('src',newSrc);
});
Fiddle: