I h开发者_StackOverflowave low resolution image which is loaded first,once it is loaded i need to replace it with a high resolution image.
I try to do so in html img tag but in throws error saying
Uncaught TypeError: Cannot read property 'width' of undefined
In order to replace the image try using
$('#Image').find('img').attr('src', ['/ImagePath/', NewImageName].join(''));
Or may be you can consider changing just the src
$('#Image').attr('src', '/ImagePath/NewImageName');
JavaScript only:
document.getElementById('idOfYourImg').src = '/new/path.png';
jQuery:
$('#idOfYourImg').attr('src', '/new/path.png');
精彩评论