Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery refresh image without refreshing page

// you can simply append a random string at the end of the image URL. 
// This will cause the browser to treat the URL as a different URL and avoid retrieving the cached version.
$(document).ready(function() {
    $("button").click(function() {
        var url = $("#container").attr("src");
        $("#container").attr("src", url + `?v=${new Date().getTime()}`);
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: react event stop propagation 
Javascript :: shadow in react native 
Javascript :: how to hide url parameters in address bar using javascript 
Javascript :: route parammap subscribe angular 9 
Javascript :: jquery add element to array 
Javascript :: install react js 
Javascript :: ip regex javascript 
Javascript :: set drain docker node 
Javascript :: redux logger 
Javascript :: encode in javascript 
Javascript :: how to always run validators mongoose 
Javascript :: TypeError: MiniCssExtractPlugin is not a constructor 
Javascript :: vuetify change text color of radio button 
Javascript :: try catch in node js 
Javascript :: Javascript find element with focus 
Javascript :: keypress javascript 
Javascript :: javascript key pressed enter 
Javascript :: dotenv nodejs 
Javascript :: nuxt js if is client 
Javascript :: angular get first element ngfor 
Javascript :: how to get the first letter of a string in jquery 
Javascript :: react native scrollview detect end 
Javascript :: get parent id javascript 
Javascript :: livewire progress indicators javascript 
Javascript :: destructure dynamic property 
Javascript :: usestate array delete 
Javascript :: onclick open link js 
Javascript :: get element by id in javascript 
Javascript :: javascript parse json string 
Javascript :: vue shortcut to create component 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =