There is a button on the page. When the button is pressed, a pop-up menu appears. The drop-down list contains an image. The problem is that the image does not load until the user clicks a button.
$("#my_button").click(function(){ $("#my_dropdown").html("<img src=\"http://mysite.com/image.jpg\" />"); });
I would like to get the image when the page loads, so that it is ready to work when the user clicks on the drop-down list. How can i do this? I thought that I could insert the image on the page using display:none so that it got into the cache, or is there a way to load when the document is loaded in jQuery?
This is for the Chrome extension if it has any meaning. I suppose I could put the image in the extension (and it will be faster), but I still wonder if it is possible to upload the image using JS.
Thanks Kevin
javascript jquery browser-cache preload
Kevin Burke Jun 24 2018-11-21T00: 00Z
source share