Simple we use to show a image by writing the following code:
<img src ="thelocationofyourimage.jpg" >
Now if sometime you need to change this src
attribute value by jQuery
. Then you need to put down the following code.
$('img[src^="thelocationofyourimage.jpg"]').each(function() {
$(this).attr('src', $(this).attr('src').replace("thelocationofyourimage.jpg", "UpdatedLocationOfTheImage.jpg"));
});
Try it by yourself. Thanks in advance.