javascript - Function to change the image onload -
i wondering how possible specific image on page , replace other image on page load. for example, have on site : <img src="/content/public/1472.png"> i want find image , change below value on page load : <img src="/content/public/1473.png"> use attr() or prop() in ready function : $(function(){ $('img[src="/content/public/1472.png"]').attr('src', '/content/public/1473.png'); //$('img[src="/content/public/1472.png"]').prop('src', '/content/public/1473.png'); }) hope helps. $(function(){ console.log('before : '+$("img").attr('src')); $('img[src="http://www.drodd.com/images15/1-4.png"]').attr('src', 'http://www.drodd.com/images15/2-4.png'); console.log('after : '+$("img").attr('src')); }) <script src="https://ajax.googleapis.com/ajax/libs/jque...