🔥 Get 650+ Tech Books and Courses for $3/m for 3 months

jQuery Run Code After Image Loads

Sam Deering

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');