🤩50% Off over 600 tech courses and books

jQuery Run Code After Image Loads

Sam Deering
Share

Simple jQuery code snippet to wait for an image to load before running some code. The only drawback is you would need to supply the image name (including extension).

$('#myImage').attr('src', 'image.jpg').load(function() {  
	//run code
	alert('Image Loaded');  
});