<img src="test.php" />
where test.php generates an image with a random number.
Itried :
$('#verifyimage').click(function() { $(this).attr('src',$(this).attr('src')); });
But it doesn't work.
Reload Images. Reload images in Tab/Window using context menu. This extensions provides a simple way to reload image using context menu. Just right on image and select "reload this image" or right click on page and click "reload all images" in Tab or Window.
newImage. src = "http://localhost/image.jpg?" + new Date(). getTime(); This will append the current timestamp automatically when you are creating the image, and it will make the browser look again for the image instead of retrieving the one in the cache.
Method 1: Using the location. reload(): The location. reload() method reloads the current web page emulating the clicking of the refresh button on the browser.
Answer: Use the jQuery attr() Method You can use the attr() method to change the image source (i.e. the src attribute of the <img> tag) in jQuery. The following example will change the image src when you clicks on the image.
You can force a refresh by appending a random string at the end, thus changing the URL:
$('#verifyimage').click(function() { $(this).attr('src', $(this).attr('src')+'?'+Math.random()); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With