Last active
April 4, 2024 22:04
-
-
Save lambdamusic/4734402 to your computer and use it in GitHub Desktop.
JavaScript: Reload an image with jQuery #js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There is no reload or replace method for images. The src property can be set in the same way as the location.href property though. | |
with($('#image')) { | |
src = src.replace(/\?.*$/, '') + '?' + Math.random(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment