javascript - changing src after page load / is executable? -


a. wondering how change src after page load using javascript

<img src="http://example.com/image.png" /> <img src="http://domain.com/different.jpg" /> 

b. second question follow - the new src of image (domain.com/different.jpg) displayed? execute new network request?

use jquery , write below code after document ready

a. $('img').attr('src','http://domain.com/different.jpg');

b. yes, image display , yes, execute new network request


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -